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

    Всего: 15

  2. Assembler / Говнокод #28534

    −3

    1. 1
    Зачем простенькие проги, написанные на MASM коннектятся к ip адресу Microsoft 20.99.133.109:443?

    BelCodeMonkey, 01 Января 2023

    Комментарии (18)
  3. Куча / Говнокод #28429

    0

    1. 1
    Как написать компилятор на PHP?

    BelCodeMonkey, 27 Октября 2022

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

    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
    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
    using System;
     
    namespace MainNamespace
    {
        class SelectionSort
        {
            private static int FindSmallest(int[] arr)
            {
                int smallest = arr[0];
                int smallestIndex = 0;
                for (int i = 1; i < arr.Length; i++)
                {
                    if (arr[i] < smallest)
                    {
                        smallest = arr[i];
                        smallestIndex = i;
                    }
                }
                return smallestIndex;
            }
            public static int[] ArraySort(int[] arr)
            {
                int[] newArr = new int[arr.Length];
                for (int i = 0; i < arr.Length; i++)
                {
                    int smallestIndex = FindSmallest(arr);
                    int arrayBeginningIndex = i;
                    newArr[arrayBeginningIndex] = arr[smallestIndex];
                    arr[smallestIndex] = Int32.MaxValue;
                }
                return newArr;
            }
        }
        class MainClass
        {
            const int sizeOfArr = 7;
            static int FindMaxProduct(int[] arr)
            {
                int maxProduct = 1;
                int firstIndex = 0;
                int secondIndex = 1;
                int lastIndex = sizeOfArr - 1;
                int beforeLastIndex = sizeOfArr - 1 - 1;
                int beforeBeforeLastIndex = sizeOfArr - 1 - 2;
     
                if (arr[firstIndex] * arr[secondIndex] * arr[lastIndex] > arr[beforeLastIndex] * arr[beforeBeforeLastIndex] * arr[lastIndex])
                {
                    maxProduct = arr[firstIndex] * arr[secondIndex] * arr[lastIndex];
                }
                else
                    for (int i = 0; i < 3; i++)
                        maxProduct *= arr[lastIndex - i];
     
                return maxProduct;
            }
            static void Main()
            {
                int[] arr = new int[sizeOfArr] {-31, 54, -39, -34, 0, 56, 92};
                arr = SelectionSort.ArraySort(arr);
                Console.WriteLine( FindMaxProduct(arr) );
                Console.ReadKey();
            }
        }
    }

    Есть массив с целыми числами. Найти в этом массиве самое большое произведение 3 чисел и вывести в консоль.

    BelCodeMonkey, 18 Июля 2021

    Комментарии (96)
  5. Куча / Говнокод #27459

    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
    if (1 != 1)
    {
        1 = 1;
    }
    else if (2 != two)
    {
        2 = 1;
    }
    else if (1 == one)
    {
        3 = two;
    }
    else if (two != three)
    {
        3 != 2;
    }
    else
    {
        DynamicSenseMessage("Are you coding with JavaScript, son?");
    }

    BelCodeMonkey, 07 Июня 2021

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

    +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
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    using System;
    
    namespace MainNamespace
    {
        class MainClass
        {
            static string str, sep;
            static void Sep()
            {
                int k = 0;
                while (k < str.Length * 2 - 5)
                {
                    if (sep.Length * (k + 1) > str.Length * 2 - 5)
                        break;
                    Console.Write(sep);
                    k++;
                }
                for (int l = 0; l < ((str.Length * 2 - 5) - (k * sep.Length)) ; l++)
                    Console.Write(sep[l]);
            }
            static void Main(string[] args)
            {
                Console.Write("str: ");
                str = Console.ReadLine();
                Console.Write("sep: ");
                sep = Console.ReadLine();
                for (int i = 0; i < str.Length-1; i++)
                    Console.Write(str[i] + " ");
                Console.Write(str[str.Length-1] + "\n\n");
                for (int j = 0; j < str.Length - 2; j++)
                {
                    Console.Write(str[j + 1] + " ");
                    Sep();
                    Console.WriteLine(" " + str[str.Length - j - 2]);
                    Console.Write("  ");
                    if(j < str.Length - 3)
                    {
                        Sep();
                        Console.WriteLine("  ");
                        continue;
                    }
                    Console.WriteLine();
                }
                for (int m = str.Length-1; m >= 1; m--)
                    Console.Write(str[m] + " ");
                Console.WriteLine(str[0]);
                Console.ReadKey();
            }
        }
    }

    Переписал код http://govnokod.ru/27324 на Шарп с небольшими улучшениями.

    BelCodeMonkey, 10 Апреля 2021

    Комментарии (2)
  7. Куча / Говнокод #27338

    0

    1. 1
    А вы знали, что вязанная бабушкина жилетка с оленями даёт +25 к навыку программирования?

    BelCodeMonkey, 06 Апреля 2021

    Комментарии (0)
  8. Куча / Говнокод #27335

    0

    1. 1
    https://puu.sh/Huwm1/b04eed45b1.png

    Слишком хорошо, чтобы быть правдой.

    BelCodeMonkey, 01 Апреля 2021

    Комментарии (8)
  9. Куча / Говнокод #27308

    0

    1. 1
    Как перестать быть хеллоуворлдщиком и стать нормальным быдлокодером?

    BelCodeMonkey, 22 Марта 2021

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

    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
    using System;
    
    namespace NoName
    {
        class TwoVariables
        {
            static void Main(string[] args)
            {
                Int32 FirstVariable = Convert.ToInt32(Console.ReadLine());
                Int32 SecondVariable = Convert.ToInt32(Console.ReadLine());
                FirstVariable = FirstVariable + SecondVariable;
                SecondVariable = FirstVariable - SecondVariable;
                FirstVariable = FirstVariable - SecondVariable;
                Console.WriteLine("First Variable is: " + FirstVariable);
                Console.WriteLine("Second Variable is: " + SecondVariable);
                Console.ReadKey();
            }
        }
    }
    
    
    
    
    
    
    
    
    
    
    // Продам гараж

    BelCodeMonkey, 15 Марта 2021

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

    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
    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
    95. 95
    96. 96
    97. 97
    98. 98
    #include <iostream>
    #include <ctime>
    #include <cstdlib>
    #include <conio.h>
    const int x_size(20), y_size(10); int x_pos(x_size/2+1); int y_pos(y_size/2+1);
    enum border_types{lineNL, single, singleNL};
    enum directions{UpLeft=1, UpRight, DownLeft, DownRight}dir;
    void draw_border(enum border_types borders) {
    	do{
    		if(borders == single || borders == singleNL) break;
    		for(int i=0; i<x_size+1; i++)
    	  	  putchar('#');
    	}while(false);
    	putchar('#');
    	if(borders == singleNL || borders == lineNL) std::cout << '\n';}
    void display_update() {
    	system("cls");
    	draw_border(lineNL);
    	for(int i=1; i<=y_size; i++)
    	{
    		draw_border(single);
    		for(int j=1; j<=x_size; j++)
    		{
    			if(j == x_pos && i == y_pos)
    			{
    				putchar('x');
    				continue;
    			}
    			putchar(32);
    		}
    		draw_border(singleNL);;
    	}
    	draw_border(lineNL);
    	std::cout << "X: " << x_pos << "\tY: " << y_pos;}
    void logic() {
    	switch(x_pos)
    	{
    		case 1:
    			if(dir == UpLeft) dir = UpRight;
    			if(dir == DownLeft) dir = DownRight;
    			break;
    		case x_size:
    			if(dir == UpRight) dir = UpLeft;
    			if(dir == DownRight) dir = DownLeft;
    	}
    	switch(y_pos)
    	{
    		case 1:
    			if(dir == UpLeft) dir = DownLeft;
    			if(dir == UpRight) dir = DownRight;
    			break;
    		case y_size:
    			if(dir == DownLeft) dir = UpLeft;
    			if(dir == DownRight) dir = UpRight;
    	}}
    void move() {
    	switch(dir)
    	{
    		case UpLeft:
    			x_pos--;
    			y_pos--;
    			break;
    		case UpRight:
    			x_pos++;
    			y_pos--;
    			break;
    		case DownLeft:
    			x_pos--;
    			y_pos++;
    			break;
    		case DownRight:
    			x_pos++;
    			y_pos++;
    	}}
    int main() {
    	srand(time(0));
    	rand();
    	switch(rand()%4+1)
    	{
    		case UpLeft:
    			dir = UpLeft;
    			break;
    		case UpRight:
    			dir = UpRight;
    			break;
    		case DownLeft:
    			dir = DownLeft;
    			break;
    		case DownRight:
    			dir = DownRight;
    	}
    	while(!kbhit())
    	{
    		display_update();
    		logic();
    		move();
    	}
    	return 0;}

    Сорян, пришлось уплотнить фигурные скобки, чтобы код уместился в 100 строк.

    BelCodeMonkey, 18 Сентября 2020

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