1. Си / Говнокод #25899

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    #include <ncurses.h>
    
    #if defined(_WIN32) || defined(_WIN64) 
        #include <windows.h>
        #define msleep(msec) Sleep(msec)
    #else
        #include <unistd.h>
        #define msleep(msec) usleep(msec*1000)
    #endif
    
    int main()
    {
        initscr();
    
        char str[100];
        addstr("Enter string: ");
        getstr(str); //Считваем строку
        curs_set(0); //"Убиваем" курсор, чтобы не мешался
        while ( true )
        {
        //Перемещаем х-координату как можно дальше вправо, и будем уменьшать её, пока она != 0
            for ( unsigned x = getmaxx(stdscr); x; x-- ) 
            {
                clear();
                mvaddstr(getmaxy(stdscr) / 2, x, str);
                refresh();
                msleep(200);
            }
        }
    
        endwin();
        return 0;
    }

    https://code-live.ru/post/ncurses-input-output/#getstr-
    Сколько хуйни вы можете найти в этом примере?

    j123123, 04 Октября 2019

    Комментарии (96)
  2. Си / Говнокод #25866

    0

    1. 1
    https://sun9-4.userapi.com/c855432/v855432603/1011cc/WhUv5xKLMsM.jpg

    OlegUP, 24 Сентября 2019

    Комментарии (9)
  3. Си / Говнокод #25849

    −1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    Сначала вот
    https://medium.com/@selamie/remove-richard-stallman-fec6ec210794
    
    А потом вот
    https://www.fsf.org/news/richard-m-stallman-resigns
    
    ПРЫЩЕБЛЯДИ СОСНУЛИ ОЧЕНЬ СЕРЬЕЗНО

    MAPTbIwKA, 17 Сентября 2019

    Комментарии (34)
  4. Си / Говнокод #25837

    0

    1. 1
    С днём Прогромиста!

    Ко-кок
    http://torvaldsfinger.com/

    LinuxGovno, 13 Сентября 2019

    Комментарии (62)
  5. Си / Говнокод #25803

    −2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    
    int main(int argc, char *argv[])
    {
    
    char** explode(char* inaddr, char s)
    {
    char**  xxx;
    xxx=(char**)malloc(strlen(inaddr));
    char* temp;
    temp=(char*)malloc(strlen(inaddr));
    
    int u=0,i=0,t=0;
    
    char* getln(char *addr)
    {
    while (*(addr+i) !=s && *(addr+i) !='\0' && *(addr+i) !=EOF)
    {temp[t]=inaddr[i];t++;i++;};
    temp[t]='\0';
    i++;t=0;
    return(temp);
    }
    
    while (inaddr[i])
    {
    xxx[u]=strdup(getln(inaddr));
    u++;
    };
    return(xxx);
    };
    
    //для проверки результата
    char* str="Y000:aa;dsf;dddsf;dsfdsf;1YYYYY;YYYYY;YYYYYY;sfd:sfdsfdsfdsfdsfdsfdsfdsf1YYYYYYY:YYYYYYYYY;b;cc;Ydsfds;876786876a:1132";
    char** eee;
    eee=(char**)malloc(strlen(str));
    
    
    eee=explode(str, ';');
    
    int zz=0;
    while(eee[zz])
    {
      printf("%s\n",eee[zz] );zz++;
    };
    printf("%c",eee[0][0] );
    printf("\n" );
    
    }

    функция explode() как php давно о такой мечтал.

    killer1804, 04 Сентября 2019

    Комментарии (21)
  6. Си / Говнокод #25799

    −2

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    #include <stdio.h>
    #include <stdlib.h>
    
    
    int main(int argc, char *argv[])
    
    //типа explode в php;
    {
    int i=0;
    //char s=';';
    char s=argv[2][0];
    
    i=100;
    //char** data;
    //data=(char**)malloc(i+1);
    char data[1000][1000];
    char* str;
    str=malloc(i+1);
    str=argv[1];
    printf("%s\n",str );
    int n=0;
    int m=0;
    
    
    while (*str) {
    if (*str==s)
    {m++;n=0;str++;continue;};
      data[m][n]=*str;
      str++;n++;
    
    };
    printf("%s\n",data[0] );
    
    }

    Типа explode в php
    Кто-нить знает как это заставить работать с
    //char** data;
    //data=(char**)malloc(i+1);
    ??

    killer1804, 03 Сентября 2019

    Комментарии (23)
  7. Си / Говнокод #25796

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    n = ((n >>  1) & 0x55555555) | ((n <<  1) & 0xaaaaaaaa);
       n = ((n >>  2) & 0x33333333) | ((n <<  2) & 0xcccccccc);
       n = ((n >>  4) & 0x0f0f0f0f) | ((n <<  4) & 0xf0f0f0f0);
       n = ((n >>  8) & 0x00ff00ff) | ((n <<  8) & 0xff00ff00);
       n = ((n >> 16) & 0x0000ffff) | ((n << 16) & 0xffff0000);
    
                    -- C code which reverses the bits in a word.

    neTyx_npoTKHyTbIu, 03 Сентября 2019

    Комментарии (77)
  8. Си / Говнокод #25791

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    #include <stdio.h>
    #include <string.h>
    #include <stdlib.h>
    
    int main(int argc, char *argv[])
    
    {
    
    
    char* line;
    char* start;
    char* dop;
    start=(char*)malloc(10000);
    dop=(char*)malloc(10000);
    start[0]='e';
    start[1]='c';
    start[2]='h';
    start[3]='o';
    start[4]=' ';
    int i=5;
    
    dop[0]=' ';
    dop[1]='|';
    dop[2]=' ';
    dop[3]=' ';
    dop[4]='b';
    dop[5]='c';
    dop[6]=' ';
    dop[7]='-';
    dop[8]='l';
    
    line=(char*)malloc(10000);
    line=argv[1];
    
    while (*line) {*(start+i)=*line;line++;i++;};
    while (*dop){*(start+i)=*dop;dop++;i++;};
    system(start);
    }

    Калькулятор

    killer1804, 01 Сентября 2019

    Комментарии (11)
  9. Си / Говнокод #25787

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    #define LOC(type, var) type var = (type) DPOP();
    #define CELL(var) LOC(const cell, var)
    #define UCELL(var) LOC(const ucell, var)
    #define ACELL(var) LOC(cell * const, var)
    #define ADCELL(var) LOC(dcell * const, var)
    #define ACHAR(var) LOC(char * const, var)
    #define STR(var) const string var = {(ucell)DPOP(), (character*)DPOP()}
    
    #define SWAP(a, b) (a ^= b ^= a ^= b)
    
    #if BYTEORDER == BYTEORDER_LE
        #define DCELL(var) dcell var = (*((dcell*) dsp)++)
        #define UDCELL(var) udcell var = (*((udcell*) dsp)++)
    #else
        #define DCELL(var) \
            SWAP(dsp[0], dsp[1]); \
            dcell var = (*((dcell*) dsp)++)
        #define UDCELL(var) \
            SWAP(dsp[0], dsp[1]); \
            udcell var = (*((udcell*) dsp)++)
    #endif
    
    #define BOOL(value) ((value) ? -1 : 0)
    
    #define DO(begin, end, stmt) do { \
        cell i = begin; \
        cell end_ = end; \
        for (; i < end_; ++i) { \
            stmt; \
        } \
    } while (0)

    Pretty_Young_Thing, 31 Августа 2019

    Комментарии (29)
  10. Си / Говнокод #25781

    −6

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    #include <stdio.h>
    
    #define my_type unsigned short
    
    int main(void) 
    {
        my_type a = 0;
    
        printf("%d\n", a);
    
        return 0;
    }

    Экое извращение

    Ksyrx, 28 Августа 2019

    Комментарии (43)