1. Лучший говнокод

    В номинации:
    За время:
  2. C# / Говнокод #9690

    +142

    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
    using System;
    
    namespace Trening_6
    {
    	class Program
    	{
    		public static void Main(string[] args)
    		{
    			Console.WriteLine("Введите 2 числа через пробел...");
    			string[] Value = Console.ReadLine().Split(new char[] {' '});
    			int Result = 0;
    			for (int i = Convert.ToInt32(Value[0]); i < Convert.ToInt32(Value[1]) + 1; i++)
    			{
    				Result += i;
    			}
    			Console.WriteLine("Сумма всех чисел в диапозоне от {0} до {1} равна {2}", Convert.ToInt32(Value[0]), Convert.ToInt32(Value[1]), Result);
    			Console.ReadKey();
    		}
    	}
    }

    Говнище еще свежее, неделю назад высрал.

    KusokGovna, 16 Марта 2012

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

    +142

    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
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    static void Reading_instruction(string Command)
    {
    	string[] CommandLine = null;
    	try
    	{
    		#region Команды консоли.
    		#region -boxmessage выводит сообщение в диалоговом окне.
    				
    		//Пример: -boxmessage:Привет!*/
    				
    		if (Command.ToLower().StartsWith("-boxmessage"))
    		{
    			CommandLine = Command.Split(new char[] {':'});
    			System.Windows.Forms.MessageBox.Show(CommandLine[1]);
    		}
    		#endregion
    		#region -errormessage выводит сообщение c ошибкой в диалоговом окне.
    				
    		//Пример: -errormessage:Вы забанены!!!:Критическая ошибка!
    				
    		if (Command.ToLower().StartsWith("-errormessage"))
    		{
    			CommandLine = Command.Split(new char[] {':'});
    			System.Windows.Forms.MessageBox.Show(CommandLine[1], CommandLine[2], System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error, System.Windows.Forms.MessageBoxDefaultButton.Button1, System.Windows.Forms.MessageBoxOptions.ServiceNotification);
    		}
    		#endregion
    		#region -consolemessage выводит текст в консоль.
    				
    		//Пример: -consolemessage:Привет!
    				
    		if (Command.ToLower().StartsWith("-consolemessage"))
    		{
    			CommandLine = Command.Split(new char[] {':'});
    			Console.WriteLine(CommandLine[1]);
    		}
    		#endregion
    		#region -killprocess убивает процесс.
    				
    		//Пример: -killprocess explorer
    				
    		if (Command.ToLower().StartsWith("-killprocess"))
    		{
    			CommandLine = Command.Split(new char[] {' '});
    			System.Diagnostics.Process[] myProcesses = System.Diagnostics.Process.GetProcessesByName(CommandLine[1]);
    			foreach (System.Diagnostics.Process instance in myProcesses)
    			{
    				instance.Kill();
    			}
    		}
    		#endregion
    		#region -startprocess запускает новый процесс или открывает файл.
    				
    		//Пример: -startprocess explorer.exe
    				
    		if (Command.ToLower().StartsWith("-startprocess"))
    		{
    			CommandLine = Command.Split(new char[] {' '});
    			System.Diagnostics.Process.Start(CommandLine[1]);
    		}
    		#endregion
    		#region -createfile создает файл.
    				
    		//Пример: -createfile С:\TestFile.txt
    				
    		if (Command.ToLower().StartsWith("-createfile"))
    		{
    			CommandLine = Command.Split(new char[] {' '});
    			System.IO.File.Create(CommandLine[1]);
    		}
    		#endregion
    		#region -deletefile удаляет файл.
    				
    		//Пример: -deletefile С:\TestFile.txt
    				
    		if (Command.ToLower().StartsWith("-deletefile"))
    		{
    			CommandLine = Command.Split(new char[] {' '});
    			System.IO.File.Delete(CommandLine[1]);
    		}
    		#endregion
    		#region -shutdown выключает компьютер.
    				
    		//Пример: -shutdown
    				
    		if (Command.ToLower().StartsWith("-shutdown"))
    		System.Diagnostics.Process.Start("shutdown", "/s /t 0");
    		#endregion
    		#region -reboot перезагружает компьютер.
    				
    		//Пример: -reboot
    				
    		if (Command.ToLower().StartsWith("-reboot"))
    			System.Diagnostics.Process.Start("shutdown", "/r /t 0");
    		#endregion

    Вот кусок говна обнаруженное в моих древних искходниках. Весь смысл закллючается в том что сервер посылает клиенту команду, а клиент ее выполняет.

    KusokGovna, 16 Марта 2012

    Комментарии (4)
  4. PHP / Говнокод #9638

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    var trololo = " ";
    $ololo = " ";
    ...
    if ($trololo==$ololo){
    echo "Совпадение первого поля со вторым - не есть хорошо.";
    }

    Зря пишу одновременно и на php и javascript, зря зря зря зря.

    servan, 10 Марта 2012

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

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    enum IsHaveItem
    //...
    switch(Havelo)
        {
            case IsHaveItem::Have: have();
            case IsHaveItem::Havent: haveOrNotHave();break;
            default:assert(false&&"Признай, что ты идиот и это не лечится!");
        }

    Говногость, 28 Февраля 2012

    Комментарии (6)
  6. PHP / Говнокод #9543

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    Zend_Validate::is('20120225 21:57:44', 'Date', array('Ymd H:i:s') // return false
    
    Zend_Validate::is('20120225', 'Date', array('Ymd') // return true
    
    Zend_Validate::is('21:57:44', 'Date', array('H:i:s') // return true

    Как сделать, что бы первая строка возвращала true?

    Slackline, 25 Февраля 2012

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

    +142

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    void main()
    {
        int mass[6]={4,1,3,5,7,0};
        quicksort(mass,5);
        while(mass[5]<7)
            printf("%d",mass[5]);
        getch();
    }

    в общем дал препод готовую программу, задание было найти ошибки, так как программа компилируется, и вроде как ошибка не очевидна, как там виндовс выполнять это будет не знаю, у меня бы вылетело с ошибкой сегментирования, делаю предположение. Изначально проблемное место выглядело примерно так:
    while(mass[5]<5)
    printf("%d",mass[mass[5]]);
    вот это исправление одного из студентов нашего потока, так это второй курс специальности ЭВМ, (facepalm)

    maksim_ovcharik, 17 Февраля 2012

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

    +142

    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 <dos.h>
    #include <conio.h>
    #include <graphics.h>
    
    
    void pix(unsigned int x, unsigned int  y, unsigned char c){
        unsigned char nb, ms, bt;                     //nomerbit maska bite
        unsigned int ofs;                      //sdvig
        unsigned char *pb;                //ukazatel na bit
    
        ofs= x/8 + y*80;
        nb=7-(x % 8);
        pb=(unsigned char *)MK_FP(0xA000, ofs);
        bt=*pb;
        ms=1<<nb;
    
        if( c !=0  ){
            bt=bt |  ms;
        }else{
            bt=bt&(~ms);
        };
    
        *pb=bt;
    };
    
    void main(){
        int drDriver, grMode;
        drDriver=VGA;
        grMode=VGAHI;
        initgraph(&drDriver, &grMode, "C:\\BORLANDC\\BGI");
        pix(60,30,15);
        getch();
    };

    13: где взял адрес
    28,29: с чего ты решил, что для паскалевского драйвера подходят определения сишного драйвера?
    30: почему драйвер паскалевский?

    all: ебанный пиздец, кто ж так пишет...

    d4rw1n1s7, 17 Февраля 2012

    Комментарии (22)
  9. PHP / Говнокод #9321

    +142

    1. 1
    $val = ( (($tmp = substr(gtbfs($num, ' '), 0, -2) ) == '') ? '0' : $tmp ) . '.' . substr(gtbfs($num, ' '), -2);

    "ЙА ЛУБЛЮ ПИЗАТЬ ОДНА СТРОЧКА БИЛЯДЬ"

    _jokz, 04 Февраля 2012

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

    +142

    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
    #include <iostream>
    
    using namespace std;
    
    int main()
    {   
        int i, n;
        cin >> n;
        int A[n];
        for(i = 0; i < n; i++)
            cin >> A[i];
        for(i = 0; i < n - 1; i++)
            swap (A[i], A [n - i + 1]); 
        for(i = 0; i < n; i++)
            cout << A[i] << " "; 
        return 0;
    }

    Помогите! Должен выводить числа массива в обратном порядкеБ а он не выводит!

    Smirnov_Alex, 30 Января 2012

    Комментарии (18)
  11. Java / Говнокод #9175

    +142

    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
    private void run() throws Exception {
    		Scanner s = new Scanner(new File("input.txt"));
    		PrintWriter p = new PrintWriter(new File("output.txt"));
    		
    		int n = s.nextInt();
    		int sum = 0;
    		
    		init();
    		
    		for(int i = 1; i <= n; i++) {
    			sum += find(i);
    		}
    		
    		p.print(sum);
    		
    		s.close();
    		p.close();
    	}
    	
    	private void init() {
    		for(int i = 0; i < 100; i++) {
    			pow_2[i] = (int) Math.pow(2, i + 1);
    		}
    		
    		for(int i = 0; i < 100; i++) {
    			pow_3[i] = (int) Math.pow(3, i + 1);
    		}
    		
    		for(int i = 0; i < 100; i++) {
    			pow_4[i] = (int) Math.pow(4, i + 1);
    		}
    		
    		for(int i = 0; i < 100; i++) {
    			pow_5[i] = (int) Math.pow(5, i + 1);
    		}
    	}
    	
    	private int find(int num) {
    		for(int i = 0; i < 100; i++) {
    			if(pow_2[i] == num) return 2;
    			if(num > pow_2[99]) break;
    		}
    		
    		for(int i = 0; i < 100; i++) {
    			if(pow_3[i] == num) return 3;
    			if(num > pow_3[99]) break;
    		}
    		
    		for(int i = 0; i < 100; i++) {
    			if(pow_4[i] == num) return 4;
    			if(num > pow_4[99]) break;
    		}
    		
    		for(int i = 0; i < 100; i++) {
    			if(pow_5[i] == num) return 5;
    			if(num > pow_5[99]) break;
    		}
    		
    		return 0;
    	}

    Говнолаба... есть идеи как оптимизировать по скорости?

    Nyashka, 19 Января 2012

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