1. Список говнокодов пользователя untitled_001

    Всего: 4

  2. C++ / Говнокод #27355

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    void main()
    {
    	unsigned char c=0;
    	for (int c = 0;c < 256; c++) {
    		cout << "the value of '" << c << "' is: " << int(c) << '\n';
    		
    	}
    	
    }

    Ой, а чойта оно повесилося и пикает?

    untitled_001, 12 Апреля 2021

    Комментарии (17)
  3. Pascal / Говнокод #26060

    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
    procedure TForm1.Button1Click(Sender: TObject);
      var
        RequestBody,SResponseBody: TStringStream;
    
        ResponseBody: string;
    begin
    
    
      try
         RequestBody := TStringStream.Create('{"login":"user","password":"pass999"}') ;
        httpconn.HandleRedirects:=TRUE;
        IdSSLIOHandlerSocketOpenSSL1.SSLOptions.Method:=sslvSSLv23;
        //httpconn.Host:='api.owencloud.ru';
        httpconn.Request.Accept:='application/xml';
        httpconn.Request.ContentLength:=68;
        httpconn.Request.ContentType:='application/x-www-form-urlencoded';
    
        ResponseBody:=httpconn.Post('https://api.owencloud.ru/v1/auth/open', RequestBody);
        SResponseBody:=TStringStream.Create(httpconn.Post('https://api.owencloud.ru/v1/auth/open', RequestBody));
        memo1.Text:=utf8toansi(ResponseBody);
        xmldocument1.LoadFromStream(SResponseBody);
     finally
        RequestBody.Free;
        SResponseBody.Free;
     end;
    end;

    Передача в мемо волшебна, а в xml так вообще виртуозна

    untitled_001, 30 Ноября 2019

    Комментарии (15)
  4. Pascal / Говнокод #22438

    −17

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    function mux(a,b:integer):integer;
    begin
     if a=1 then mux:=b
     else if (a=0) or (b=0) then mux:=0
     else if (a<0) and (b<0) then  mux:= mux(-b-1, -a) - a
     else
      mux:= mux(b-1, a) + a;
    end;

    Лабораторная работа. Умножение чисел.

    untitled_001, 24 Февраля 2017

    Комментарии (22)
  5. Pascal / Говнокод #22024

    −49

    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
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    type
    TReadCoils = array [0..3] of word;
    
    CONST crctab: ARRAY[0..255] OF WORD = (
        $0000, $C0C1, $C181, $0140, $C301, $03C0, $0280, $C241,
        $C601, $06C0, $0780, $C741, $0500, $C5C1, $C481, $0440,
        $CC01, $0CC0, $0D80, $CD41, $0F00, $CFC1, $CE81, $0E40,
        $0A00, $CAC1, $CB81, $0B40, $C901, $09C0, $0880, $C841,
        $D801, $18C0, $1980, $D941, $1B00, $DBC1, $DA81, $1A40,
        $1E00, $DEC1, $DF81, $1F40, $DD01, $1DC0, $1C80, $DC41,
        $1400, $D4C1, $D581, $1540, $D701, $17C0, $1680, $D641,
        $D201, $12C0, $1380, $D341, $1100, $D1C1, $D081, $1040,
        $F001, $30C0, $3180, $F141, $3300, $F3C1, $F281, $3240,
        $3600, $F6C1, $F781, $3740, $F501, $35C0, $3480, $F441,
        $3C00, $FCC1, $FD81, $3D40, $FF01, $3FC0, $3E80, $FE41,
        $FA01, $3AC0, $3B80, $FB41, $3900, $F9C1, $F881, $3840,
        $2800, $E8C1, $E981, $2940, $EB01, $2BC0, $2A80, $EA41,
        $EE01, $2EC0, $2F80, $EF41, $2D00, $EDC1, $EC81, $2C40,
        $E401, $24C0, $2580, $E541, $2700, $E7C1, $E681, $2640,
        $2200, $E2C1, $E381, $2340, $E101, $21C0, $2080, $E041,
        $A001, $60C0, $6180, $A141, $6300, $A3C1, $A281, $6240,
        $6600, $A6C1, $A781, $6740, $A501, $65C0, $6480, $A441,
        $6C00, $ACC1, $AD81, $6D40, $AF01, $6FC0, $6E80, $AE41,
        $AA01, $6AC0, $6B80, $AB41, $6900, $A9C1, $A881, $6840,
        $7800, $B8C1, $B981, $7940, $BB01, $7BC0, $7A80, $BA41,
        $BE01, $7EC0, $7F80, $BF41, $7D00, $BDC1, $BC81, $7C40,
        $B401, $74C0, $7580, $B541, $7700, $B7C1, $B681, $7640,
        $7200, $B2C1, $B381, $7340, $B101, $71C0, $7080, $B041,
        $5000, $90C1, $9181, $5140, $9301, $53C0, $5280, $9241,
        $9601, $56C0, $5780, $9741, $5500, $95C1, $9481, $5440,
        $9C01, $5CC0, $5D80, $9D41, $5F00, $9FC1, $9E81, $5E40,
        $5A00, $9AC1, $9B81, $5B40, $9901, $59C0, $5880, $9841,
        $8801, $48C0, $4980, $8941, $4B00, $8BC1, $8A81, $4A40,
        $4E00, $8EC1, $8F81, $4F40, $8D01, $4DC0, $4C80, $8C41,
        $4400, $84C1, $8581, $4540, $8701, $47C0, $4680, $8641,
        $8201, $42C0, $4380, $8341, $4100, $81C1, $8081, $4040 );
    
     //ôóíêöèÿ íàõîæäåíèÿ êîíòðîëüíîé ñóììû
    function crc16(twoSym:array of Word; size:word):Word;
    var
     i:Integer;
     crc:Word;
    begin
      crc:=$FFFF;
    
      for i:=0 to ((size div 2) -1) do
    
      begin
        crc:=  (crc shr 8) xor CrcTab[(crc and $FF) xor twoSym[i]];
      end;
       Result:=(crc shr 8) or (crc shl 8);
    end;
    function ReadCoils(DeviceAddress: byte; StartingAddress:word; QuantityCoils : word): TReadCoils;
      var
    
        Datagramm: Array[0..3] of Word;
         ToPort: Array[0..5] of word;
    begin
        Datagramm[0]:=TwoBytesToWord(DeviceAddress,$3);
        Datagramm[1]:=TwoBytesToWord(hi(StartingAddress),lo(StartingAddress));
        Datagramm[2]:=TwoBytesToWord(hi(QuantityCoils),lo(QuantityCoils));
         ToPort[0]:=hi(datagramm[0]);
         ToPort[1]:=lo(datagramm[0]);
         ToPort[2]:=hi(datagramm[1]);
         ToPort[3]:=lo(datagramm[1]);
         ToPort[4]:=hi(datagramm[2]);
         ToPort[5]:=lo(datagramm[2]);
         Datagramm[3]:=crc16(toport,12);
    end;

    Вот такими костылями заставляем вычисляться CRC-16 для Modbus в Readcoils

    untitled_001, 23 Января 2017

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