1. C# / Говнокод #24808

    0

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    // тухло 
    if (json.Contains("message")) 
    { 
        classOperatios.ResultOper2 result2 = JsonConvert.DeserializeObject<classOperatios.ResultOper2>(json); 
        MessageBox.Show(result2.message + (char)13 + (char)10 + result2.errors); 
    }

    Царский код. Как склеить две строки с разделителем "новая строка".

    awesome3000, 25 Сентября 2018

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

    0

    1. 1
    2. 2
    //Breakpoint
    bool[] bp = new bool[1]; bp[1] = true;

    Чувак сказал, что так ему удобнее.

    jdryand, 19 Сентября 2018

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

    −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
    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
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
     
    namespace sortQuick                 {class quickSort{
            private int[] array = new int[20]; ;; private int len;
            public void QuickSort()         {sort(0, len - 1);}
     
            public void sort(int left, int right){int pivot, leftend, rightend;
    leftend = left;
                                                                           rightend = right;
                pivot = array[left];
                while (left < right){
                    while ((array[right] >= pivot) && (left < right)){right--;}if (left != right)                  {
                        array[left] = array[right];                                                                 left++;}
     
    while ((array[left] <= pivot) && (left < right)){
                        left++;}
     if (left != right){array[right] = array[left];right--;}}
     
                array[left] = pivot;pivot = left;
                                                                                                                                                        left = leftend;
                right = rightend;
     
    if (left < pivot)
                {sort(left, pivot - 1);}
     if (right > pivot){sort(pivot + 1, right);}}
     
            public static void Main(){
                quickSort q_Sort = new quickSort();
     
                int[] array = { 4, 3, 1, 4, 6, 7, 5, 4, 32, 5, 26, 187, 8 };
                q_Sort.array = array;
                q_Sort.len = q_Sort.array.Length;
                q_Sort.QuickSort();
     
                for (int j = 0; j < q_Sort.len; j++){Console.WriteLine(q_Sort.array[j]);}
                Console.ReadKey();}}}

    Мучайтесь си диезники хреновы

    Ksyrx, 16 Сентября 2018

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

    −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
    int[][] arr = new int[3][];
                arr[0] = new int[3];
                arr[1] = new int[2];
                arr[2] = new int[5];
                arr[0][2] = 16;
                arr[1][0] = 45;
                arr[2][4] = 99;
                foreach (int item in arr[0])
                    Console.Write(item + " ");
                Console.WriteLine();
                foreach (int item in arr[1])
                    Console.Write(item + " ");
                Console.WriteLine();
                foreach (int item in arr[2])
                    Console.Write(item + " ");
    
    Этот foreach просто божественен

    Auzergos, 14 Сентября 2018

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

    −1

    1. 1
    Нах c#, если есть Java?

    shite, 19 Августа 2018

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

    0

    1. 001
    2. 002
    3. 003
    4. 004
    5. 005
    6. 006
    7. 007
    8. 008
    9. 009
    10. 010
    11. 011
    12. 012
    13. 013
    14. 014
    15. 015
    16. 016
    17. 017
    18. 018
    19. 019
    20. 020
    21. 021
    22. 022
    23. 023
    24. 024
    25. 025
    26. 026
    27. 027
    28. 028
    29. 029
    30. 030
    31. 031
    32. 032
    33. 033
    34. 034
    35. 035
    36. 036
    37. 037
    38. 038
    39. 039
    40. 040
    41. 041
    42. 042
    43. 043
    44. 044
    45. 045
    46. 046
    47. 047
    48. 048
    49. 049
    50. 050
    51. 051
    52. 052
    53. 053
    54. 054
    55. 055
    56. 056
    57. 057
    58. 058
    59. 059
    60. 060
    61. 061
    62. 062
    63. 063
    64. 064
    65. 065
    66. 066
    67. 067
    68. 068
    69. 069
    70. 070
    71. 071
    72. 072
    73. 073
    74. 074
    75. 075
    76. 076
    77. 077
    78. 078
    79. 079
    80. 080
    81. 081
    82. 082
    83. 083
    84. 084
    85. 085
    86. 086
    87. 087
    88. 088
    89. 089
    90. 090
    91. 091
    92. 092
    93. 093
    94. 094
    95. 095
    96. 096
    97. 097
    98. 098
    99. 099
    100. 100
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    
    
    namespace SoloLearn
    {
        class Program
        {
            /**
             * Extension to simplify code writing
             */
            static string Read()
            {
                return Console.ReadLine();
            }
            static void Print(string val, bool newline)
            {
                if(newline)
                {
                    Console.WriteLine(val);
                }
                else
                {
                    Console.Write(val);
                }
            }
            static void Print(double val, bool newline)
            {
                if(newline)
                {
                    Console.WriteLine(val.ToString());
                }
                else
                {
                    Console.Write(val.ToString());
                }
            }
            static void Print(bool val, bool newline)
            {
                if(newline)
                {
                    Console.WriteLine(val.ToString());
                }
                else
                {
                    Console.Write(val.ToString());
                }
            }
            static void Print(int val, bool newline)
            {
                if(newline)
                {
                    Console.WriteLine(val.ToString());
                }
                else
                {
                    Console.Write(val.ToString());
                }
            }
            /**
             * End of extension
             */
            
            static int ToBase(int number, int nbase = 2)
            {
                int converted = 0;
                if(number == 0)
                {
                    return 0;
                }
                else
                {
                    while(number > 0)
                    {
                        converted = converted * 10 + (number % nbase);
                        number /= nbase;
                    }
                }
                return converted.ToString().Reverse().Aggregate(0, (b, x) => 10 * b + x - '0');
            }
            /** Use:
             * The first number is the convertable
             * The second is the base
             */
            static void Main(string[] args)
            {
                int num = int.Parse(Read());
                int nnbase = int.Parse(Read());
                Print("The number is: ", false);
                Print(num, true);
                Print("The base is: ", false);
                Print(nnbase, true);
                Print("The conv. number is: ", false);
                Print(ToBase(num, nnbase), true);
            }
        }
    }

    Говно ли это? Конвертит числа

    shite, 13 Августа 2018

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

    0

    1. 1
    2. 2
    Ненавижу "Console.WriteLine("something");", "Cube coin = new Cube(2);" и "int[ , ] arr = new int[2,3];".
    В крестах все проще: "cout << "something";", "Cube coin(2);" и "int arr[2,3];".

    Для меня идеальным языком был бы сисярп с синтаксисом крестов.

    shite, 08 Августа 2018

    Комментарии (20)
  8. C# / Говнокод #24573

    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
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text.RegularExpressions;
    
    
    /* The "Enter le ..." thing
    is left for Шindows compilers.
    Don't mind it. */
     namespace SoloLearn
     {
         public class Program
         {
             public static void Main(string[] args)
             {
                 int a = 0;
                 int b = 0; //Declare two numbers
                 string leChar; //Declare the character
                 int sum; //Declare the place where the result of the expression would be stored
                 Console.WriteLine("Enter le first number\n");
                 string c = a.ToString(); //Convert the 1st № to string
                 c = Console.ReadLine(); //Assign the 1st number
                 Console.WriteLine("Enter le character\n");
                 leChar = Console.ReadLine(); //Assign the char
                 Console.WriteLine("Enter le second number\n");
                 string d = b.ToString(); //Convert the 2nd № to string
                 d = Console.ReadLine(); //Assign the second number
                 a = System.Convert.ToInt16(c);
                 b = System.Convert.ToInt16(d);
                 sum = Calculate(a,leChar,b); //Calculate
                 Console.WriteLine("{0} {1} {2} is {3}", a, leChar, b, sum);
             }
             public static int Calculate(int x, string z, int y) {
                 int qwerty = 0;
                 switch(z) {
                     case "+": //Case of addition
                     qwerty = x + y;
                     break;
                     case "-": //Case of subtraction
                     qwerty = x - y;
                     break;
                     case "*": //Case of multiplication
                     qwerty = x * y;
                     break;
                     case "/": //Case of division
                     qwerty = x / y;
                     break;
                 }
                 return qwerty; //If smth = Calculate(parameters), var smth would have the content of this var © Your Captain Obvious
             }
         }
     }

    Выдавил из себя где-то месЕц назад. Как я умудрялся делать 2 переменные для просто стринговых версий существующих переменных только для того, чтобы прочитать инпут? Хорошо, что в сисярпе есть гарбаж коллектор. И да, названия переменных во второй функции - прекрасные (посмотрите: x, y, z, qwerty - не прекрасно ли?) говГо.

    shite, 03 Августа 2018

    Комментарии (12)
  9. C# / Говнокод #24549

    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
    using System;
    using System.Net;
    using System.Net.Sockets;
    using System.IO;
    using System.Linq;
    using System.Collections.Generic;
    
    namespace CSharp_Shell
    {
        public class Program
        {
            static int flipACoin() {
                Random rand = new Random();
                int coin = rand.Next(0,2);
                return coin;
            }
            public static void Main(string[] args)
            {
                int headsCount = 0; 
                int tailsCount = 0;
                int tmp;
                Console.Write("Enter a number of flips\n");
                for(int flips = int.Parse(Console.ReadLine()); flips > 0; flips--) 
                {
                    Console.Write("You flipped: ");
                    tmp = flipACoin();
                    if(tmp == 1) 
                    {
                        Console.Write("Heads\n");
                        headsCount++;
                    }
                    else 
                    {
                        Console.Write("Tails\n");
                        tailsCount++;
                    }
                }
                Console.Write("Heads: " + headsCount + "\nTails: " + tailsCount + "\n");
            }
        }
    }

    Флипает коинсу по аглицки. Есть ли это говнокодом?

    shite, 27 Июля 2018

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

    −2

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    Как покласть в exception этот сайт:
    
    1. Заходим в форму регистрации
    2. Вводим данные: Ник //, мыло любое, пароль /*, подтверждение */
    3. ???
    4. PROFIT!

    shite, 27 Июля 2018

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