1. Pascal / Говнокод #8282

    +84

    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
    program index;
    uses crt;
    const y=20;
    var a:array[1..y]of Integer;
        i,
        j,
        x,
        Found:Integer;
    begin
      clrscr;
      Found:=0;
      for i:=1 to y do
      begin
        WriteLn('Vvedite ',i,'- and element massiva');
        ReadLn(a[i]);
      end;
      Write('Vvedite X=');
      ReadLn(x);
      for i:=1 to y do
        for j:=i+1 to y do
        begin
          if (x=(Sqr(a[i])+Sqr(a[j]))) then
          begin
            Found:=Found+1;
            WriteLn('a=',a[i],' b=',a[j]);
          end;
        end;
      if Found=0 then
            WriteLn('Takih chisel net');
      ReadLn;
    end.

    одномерный числовой масив

    ITdocer, 23 Октября 2011

    Комментарии (29)
  2. Pascal / Говнокод #8281

    +146

    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
    program chet;
    uses crt;
    var a,
        b,
        x,
        y:Integer;
    begin
      clrscr;
      Write('Vvedite X=');
      ReadLn(x);
      Write('Vvedite Y=');
      ReadLn(y);
      for a:=0 to 30000 do
        for b:=0 to 30000 do
        begin
          if (a+b=x)and(a*b=y) then
          begin
            Write('a=',a);
            WriteLn('b=',b);
          end;
        end;
      ReadLn;
    end.

    находи все возможные пары A и B!

    ITdocer, 23 Октября 2011

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

    +147

    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
    program s_27;
    uses crt;
    function SummaCifr(n:integer):byte;
    
    var s,
        x:integer;
    {----------------------------------------------------------------------------}
    begin
      clrscr;
      s:=0;
      x:=n;
      while x>0 do begin
        s:=s+(x mod 10);
    
        x:=x div 10;
      end;
      SummaCifr:=s;
    end;
    {----------------------------------------------------------------------------}
    var i,k:integer;
    begin
      i:=2;
      k:=99;
      while SummaCifr(k)<>27 do
      begin
        k:=i*99;
        inc(i);
      end;
      WriteLn('Rezult:',k);
      ReadLn;
    end.

    поиск числа!

    ITdocer, 23 Октября 2011

    Комментарии (10)
  4. C++ / Говнокод #8279

    +146

    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
    #include<stdio.h>
    #include<conio.h>
    #include<math.h>
    #include<stdlib.h>
    void main(){
    int Kliuci,X,Y,a,b,interval=10;
    float T,sum=0;
    m3:
    clrscr();
    printf("\n\r  *****************\n\r");
    printf("     1|FOR\n\r");
    printf("     2|WHILE\n\r");
    printf("     0|EXIT\n\r");
    printf("       ****************\n\r");
    printf("Vvedite Kliuci:");
    scanf("%d",&Kliuci);
    switch(Kliuci)
    {case 1 :
    {//for
    printf("Vvedite znacenia:a,b\n");
    scanf("%d%d",&a,&b);
    printf("Vvedite interval min 10 X=n<Y+Y:\n");
    scanf("%d%d",&X,&Y);
    printf("\n\r   ********RESULT*******\r");
    printf("\n\r    --Interval-----Rezulitat\n\r");
    for(int k=X*X;k<Y+1;k++)
    {
    T=pow(b,2)+a/2+(pow(a,4)/4)-(pow(b,6)/6)+k;
    printf("  |\t %d",k);
    printf("-");
    printf("\t  %f \n\r",T);
    interval++;
    sum+=T; }
    printf("\n\r  *********************\n\r");
    printf("Vesi interval:%d\n\r",interval);
    printf("Vesi rezulitat: %f",sum);
    getch();}
    break;
    case 2:
    {//while
    printf("Vvedite znacenia:a,b\n");
    scanf("%d%d",&a,&b);
    printf("Vvedite interval min 10 X=n<Y+Y:\n");
    scanf("%d%d",&X,&Y);
    printf("\n\r   ********RESULT********\r");
    printf("\n\r    --Interval-----Rezulitat\n\r");
    int k=X*X;
    while(k<Y+1)
    T=pow(b,2)+a/2+(pow(a,4)/4)-(pow(b,6)/6)+k;
    k++;
    printf("  |\t %d",k);
    printf("-");
    printf("\t  %f \n\r",T);
    interval++;
    sum+=T; }
    printf("\n\r  **********************\n\r");
    printf("Vesi interval:%d\n\r",interval);
    printf("Vesi rezulitat: %f",sum);
    getch();
    break;
    case 0:
    exit(0); }
    break;
    }
    goto m3;}

    http://hashcode.ru/questions/45871/где-ошибки-не-работает-компильтор

    >goto
    >void main
    >...

    TheHamstertamer, 23 Октября 2011

    Комментарии (13)
  5. C++ / Говнокод #8278

    +1004

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    init1(); 
    !isFailed1() && init2(); 
    !isFailed1() && !isFailed2() && init3(); 
    !isFailed1() && !isFailed2() && !isFailed3() && work();
    !isFailed3() && cleunUp3(); 
    !isFailed2() && cleunUp2(); 
    !isFailed1() && cleunUp1();

    И этот думает, что RAII не нужен.

    AnimeGovno-_-, 22 Октября 2011

    Комментарии (17)
  6. C++ / Говнокод #8277

    +1000

    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
    int i = 0;
    
    init1();
    ++i;
    if (!isFailed1()) goto clean_up;
    
    init2();
    ++i;
    if (!isFailed2()) goto clean_up;
    
    init3();
    ++i;
    if (!isFailed3()) goto clean_up;
    
    goto end:
    
    clean_up:
    
    switch(i) {
      case 3:
        cleunUp3();
      case 2:
        cleunUp2();
      case 1:
        cleunUp1();
    }
    
    end:

    Он думает, что RAII не нужен.

    AnimeGovno-_-, 22 Октября 2011

    Комментарии (15)
  7. C++ / Говнокод #8276

    +997

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    list<int> l;
    //...
    for(int i=0;i<l.size();++i)
    {
     auto it=l.begin();
     advance(it, i);
     int item=*it;
     //...

    AnimeGovno-_-, 22 Октября 2011

    Комментарии (74)
  8. JavaScript / Говнокод #8275

    +163

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    Электронная почта (e-mail) - если указано, то проверяем корректность
    
    p_email = document.myform.email.value.toString();
    if (p_email != "") {
    t = p_email.indexOf("@");
    if((p_email.indexOf(".") == -1) || (t == -1) || (t < 1) || (t > p_email.length - 5) || (p_email.charAt(t - 1) == '.') || (p_email.charAt(t + 1) == '.')) {
    alert("Некорректно указан E-mail !");
    document.myform.email.focus();
    return false;
    }
    }

    http://www.whatis.ru/razn/razn14.shtml

    denis90, 22 Октября 2011

    Комментарии (4)
  9. Java / Говнокод #8274

    +80

    1. 1
    2. 2
    3. 3
    4. 4
    getBtnContent().setEnabled(enable);
    if (getGridConfig().isContentEnabled()) {
           getBtnContent().setEnabled(enable);
    }

    Программист со стажем, всегда хочет быть уверен что кнопка будет доступна на 150%

    pvtPyle, 22 Октября 2011

    Комментарии (2)
  10. C# / Говнокод #8273

    +116

    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
    <Grid Grid.Row="2" Margin="5">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                    <RowDefinition Height="auto"/>
                </Grid.RowDefinitions>
                <ContentPresenter Grid.Row="0" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[0]}"/>
                <ContentPresenter Grid.Row="0" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[1]}"/>
                <ContentPresenter Grid.Row="0" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[2]}"/>
                <ContentPresenter Grid.Row="1" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[3]}"/>
                <ContentPresenter Grid.Row="1" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[4]}"/>
                <ContentPresenter Grid.Row="1" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[5]}"/>
                <ContentPresenter Grid.Row="2" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[6]}"/>
                <ContentPresenter Grid.Row="2" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[7]}"/>
                <ContentPresenter Grid.Row="2" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[8]}"/>
                <ContentPresenter Grid.Row="3" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[9]}"/>
                <ContentPresenter Grid.Row="3" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[10]}"/>
                <ContentPresenter Grid.Row="3" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[11]}"/>
                <ContentPresenter Grid.Row="4" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[12]}"/>
                <ContentPresenter Grid.Row="4" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[13]}"/>
                <ContentPresenter Grid.Row="4" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[14]}"/>
                <ContentPresenter Grid.Row="5" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[15]}"/>
                <ContentPresenter Grid.Row="5" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[16]}"/>
                <ContentPresenter Grid.Row="5" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[17]}"/>
                <ContentPresenter Grid.Row="6" Grid.Column="0" Content="{Binding ElementName=root,Path=Items[18]}"/>
                <ContentPresenter Grid.Row="6" Grid.Column="1" Content="{Binding ElementName=root,Path=Items[19]}"/>
                <ContentPresenter Grid.Row="6" Grid.Column="2" Content="{Binding ElementName=root,Path=Items[20]}"/>            
            </Grid>

    legat, 22 Октября 2011

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