Advertisement
onomato90

Quiz wer beta

Jul 24th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 10.48 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Toci.Training.MichalJ
  8. {
  9.     class quiz
  10.     {
  11.         public static void codingQuiz()
  12.         {
  13.             Console.WriteLine("Witaj w quizie dla kandydatow na programistow.");
  14.             Console.ReadKey();
  15.             Console.WriteLine();
  16.             Console.WriteLine("Oto pytania: ");
  17.  
  18.             string[] questionsBase = new string[]
  19.             {
  20.                 "1. blablabla",
  21.                 "2. bablabl",
  22.                 "3. blablaba",
  23.                 "4. blabla",
  24.                 "5. bablabla",
  25.                 "6. blablbla"
  26.             };
  27.  
  28.             string[][] answersBase = new string[questionsBase.Length][];
  29.  
  30.             answersBase[0] = new string[]
  31.             {
  32.                 "a) dadda",
  33.                 "b) fasfsa ",
  34.                 "c) safsfsaf",
  35.                 "d) safsafsaf"
  36.             };
  37.  
  38.             answersBase[1] = new string[]
  39.             {
  40.                 "a) ",
  41.                 "b) ",
  42.                 "c) ",
  43.                 "d) "
  44.             };
  45.  
  46.             answersBase[2] = new string[]
  47.             {
  48.                 "a) ",
  49.                 "b) ",
  50.                 "c) ",
  51.                 "d) "
  52.             };
  53.  
  54.             answersBase[3] = new string[]
  55.             {
  56.                 "a) ",
  57.                 "b) ",
  58.                 "c) ",
  59.                 "d) "
  60.             };
  61.  
  62.             answersBase[4] = new string[]
  63.             {
  64.                 "a) ",
  65.                 "b) ",
  66.                 "c) ",
  67.                 "d) "
  68.             };
  69.  
  70.             answersBase[5] = new string[]
  71.             {
  72.                 "a) ",
  73.                 "b) ",
  74.                 "c) ",
  75.                 "d) "
  76.             };
  77.  
  78.            
  79.  
  80.             for (int i = 0; i < questionsBase.Length; i++)
  81.             {
  82.                 Console.WriteLine(questionsBase[i]);
  83.                 Console.WriteLine();
  84.  
  85.                 for (int j = 0; j < answersBase[i].Length; j++)
  86.                 {
  87.                     Console.WriteLine(answersBase[i][j]);
  88.                 }
  89.  
  90.                 while (i == 0 || i == 4)
  91.                 {
  92.                     char odp1;
  93.                     Console.WriteLine();
  94.                     Label1: Console.WriteLine("Podaj odpowiedz: ");
  95.                     odp1 = (char)Console.Read();
  96.                     switch (odp1)
  97.                     {
  98.                         case 'a':
  99.                             {
  100.                                 Console.WriteLine();
  101.                                 Console.WriteLine("Zla odpowiedz");
  102.                                 Console.WriteLine();
  103.                                 goto Label1;
  104.                             }
  105.                         case 'b':
  106.                             {
  107.                                 Console.WriteLine();
  108.                                 Console.WriteLine("Zla odpowiedz");
  109.                                 Console.WriteLine();
  110.                                 goto Label1;
  111.                             }
  112.                         case 'c':
  113.                             {
  114.                                 Console.WriteLine();
  115.                                 Console.WriteLine("Dobrze!");
  116.                                 Console.WriteLine();
  117.                                 break;
  118.                             }
  119.                         case 'd':
  120.                             {
  121.                                 Console.WriteLine();
  122.                                 Console.WriteLine("Zla odpowiedz");
  123.                                 Console.WriteLine();
  124.                                 goto Label1;
  125.                             }
  126.                         default:
  127.                             {
  128.                                 Console.WriteLine();
  129.                                 Console.WriteLine("Podaj odpowiedz a, b, c lub d");
  130.                                 Console.WriteLine();
  131.                                 goto Label1;
  132.                             }
  133.                     }
  134.  
  135.                         if (odp1 == 'c')
  136.                         break;
  137.                    
  138.                 }
  139.                
  140.                     while (i == 3 || i == 5)
  141.                     {
  142.                         char odp2;
  143.                         Console.WriteLine();
  144.                         Label2:  Console.WriteLine("Podaj odpowiedz: ");
  145.                         odp2 = (char) Console.Read();
  146.                         switch (odp2)
  147.                         {
  148.                             case 'a':
  149.                             {
  150.                                 Console.WriteLine();
  151.                                 Console.WriteLine("Dobrze!");
  152.                                 Console.WriteLine();
  153.                                 break;
  154.                             }
  155.                             case 'b':
  156.                             {
  157.                                 Console.WriteLine();
  158.                                 Console.WriteLine("Zla odpowiedz");
  159.                                 Console.WriteLine();
  160.                                 goto Label2;
  161.                             }
  162.                             case 'c':
  163.                             {
  164.                                 Console.WriteLine();
  165.                                 Console.WriteLine("Zla odpowiedz");
  166.                                 Console.WriteLine();
  167.                                 goto Label2;
  168.                             }
  169.                             case 'd':
  170.                             {
  171.                                 Console.WriteLine();
  172.                                 Console.WriteLine("Zla odpowiedz");
  173.                                 Console.WriteLine();
  174.                                 goto Label2;
  175.                             }
  176.                             default:
  177.                             {
  178.                                 Console.WriteLine();
  179.                                 Console.WriteLine("Podaj odpowiedz a, b, c lub d");
  180.                                 Console.WriteLine();
  181.                                 goto Label2;
  182.                             }
  183.                         }
  184.  
  185.                         if (odp2 == 'a')
  186.                         break;
  187.                    
  188.                     }
  189.                    
  190.                     while (i == 1)
  191.                     {
  192.                         char odp3;
  193.                         Console.WriteLine();
  194.                         Label3: Console.WriteLine("Podaj odpowiedz: ");
  195.                         odp3 = (char) Console.Read();
  196.                         switch (odp3)
  197.                         {
  198.                             case 'a':
  199.                             {
  200.                                 Console.WriteLine();
  201.                                 Console.WriteLine("Zla odpowiedz");
  202.                                 Console.WriteLine();
  203.                                 goto Label3;
  204.                             }
  205.                             case 'b':
  206.                             {
  207.                                 Console.WriteLine();
  208.                                 Console.WriteLine("Zla odpowiedz");
  209.                                 Console.ReadKey();
  210.                                 goto Label3;
  211.                             }
  212.                             case 'c':
  213.                             {
  214.                                 Console.WriteLine();
  215.                                 Console.WriteLine("Zla odpowiedz");
  216.                                 Console.WriteLine();
  217.                                 goto Label3;
  218.                             }
  219.                             case 'd':
  220.                             {
  221.                                 Console.WriteLine();
  222.                                 Console.WriteLine("Dobrze!");
  223.                                 Console.WriteLine();
  224.                                 break;
  225.                             }
  226.                             default:
  227.                             {
  228.                                 Console.WriteLine();
  229.                                 Console.WriteLine("Podaj odpowiedz a, b, c lub d");
  230.                                 Console.WriteLine();
  231.                                 goto Label3;
  232.                             }
  233.                         }
  234.  
  235.                         if (odp3 == 'd')
  236.                         break;
  237.  
  238.                     }
  239.                
  240.                     while (i == 2)
  241.                     {
  242.                         char odp4;
  243.                         Console.WriteLine();
  244.                         Label4: Console.WriteLine("Podaj odpowiedz: ");
  245.                         odp4 = (char) Console.Read();
  246.                         switch (odp4)
  247.                         {
  248.                             case 'a':
  249.                             {
  250.                                 Console.WriteLine();
  251.                                 Console.WriteLine("Zla odpowiedz");
  252.                                 Console.WriteLine();
  253.                                 goto Label4;
  254.                             }
  255.                             case 'b':
  256.                             {
  257.                                 Console.WriteLine();
  258.                                 Console.WriteLine("Dobrze!");
  259.                                 Console.WriteLine();
  260.                                 break;
  261.                             }
  262.                             case 'c':
  263.                             {
  264.                                 Console.WriteLine();
  265.                                 Console.WriteLine("Zla odpowiedz");
  266.                                 Console.WriteLine();
  267.                                 goto Label4;
  268.                             }
  269.                             case 'd':
  270.                             {
  271.                                 Console.WriteLine();
  272.                                 Console.WriteLine("Zla odpowiedz");
  273.                                 Console.WriteLine();
  274.                                 goto Label4;
  275.                             }
  276.                             default:
  277.                             {
  278.                                 Console.WriteLine();
  279.                                 Console.WriteLine("Podaj odpowiedz a, b, c lub d");
  280.                                 Console.WriteLine();
  281.                                 goto Label4;
  282.                             }
  283.                         }
  284.  
  285.                         if (odp4 == 'b')
  286.                         break;
  287.                    
  288.                     }
  289.                
  290.                 Console.ReadKey();
  291.  
  292.             }
  293.  
  294.             Console.ReadKey();
  295.  
  296.         }
  297.     }
  298. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement