Advertisement
onomato90

quiz wer.1

Jul 21st, 2017
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 7.99 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.             char odp;
  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.                 Console.WriteLine(answersBase[i][j]);
  87.  
  88.                 if (i == 0 && i == 4)
  89.                 {
  90.                     do
  91.                     {
  92.                         Console.WriteLine();
  93.                         Console.WriteLine("Podaj odpowiedz: ");
  94.                         odp = (char) Console.Read();
  95.                         switch (odp)
  96.                         {
  97.                             case 'a':
  98.                             {
  99.                                 Console.WriteLine("Zla odpowiedz");
  100.                                 break;
  101.                             }
  102.                             case 'b':
  103.                             {
  104.                                 Console.WriteLine("Zla odpowiedz");
  105.                                 break;
  106.                             }
  107.                             case 'c':
  108.                             {
  109.                                 Console.WriteLine("Dobrze!");
  110.                                 break;
  111.                             }
  112.                             case 'd':
  113.                             {
  114.                                 Console.WriteLine("Zla odpowiedz");
  115.                                 break;
  116.                             }
  117.                             default:
  118.                             {
  119.                                 Console.WriteLine("Podaj odpowiedz a, b, c lub d");
  120.                                 break;
  121.                             }
  122.                         }
  123.                     } while (i == 0 && i == 4);
  124.                 }
  125.  
  126.                 if (i == 3 && i == 5)
  127.                 {
  128.                     do
  129.                     {
  130.                         Console.WriteLine();
  131.                         Console.WriteLine("Podaj odpowiedz: ");
  132.                         odp = (char) Console.Read();
  133.                         switch (odp)
  134.                         {
  135.                             case 'a':
  136.                             {
  137.                                 Console.WriteLine("Dobrze!");
  138.                                 break;
  139.                             }
  140.                             case 'b':
  141.                             {
  142.                                 Console.WriteLine("Zla odpowiedz");
  143.                                 break;
  144.                             }
  145.                             case 'c':
  146.                             {
  147.                                 Console.WriteLine("Zla odpowiedz");
  148.                                 break;
  149.                             }
  150.                             case 'd':
  151.                             {
  152.                                 Console.WriteLine("Zla odpowiedz");
  153.                                 break;
  154.                             }
  155.                             default:
  156.                             {
  157.                                 Console.WriteLine("Podaj odpowiedz a, b, c lub d");
  158.                                 break;
  159.                             }
  160.                         }
  161.                     } while (i == 3 && i == 5);
  162.                 }
  163.  
  164.                 if (i == 1)
  165.                 {
  166.                     do
  167.                     {
  168.                         Console.WriteLine();
  169.                         Console.WriteLine("Podaj odpowiedz: ");
  170.                         odp = (char) Console.Read();
  171.                         switch (odp)
  172.                         {
  173.                             case 'a':
  174.                             {
  175.                                 Console.WriteLine("Zla odpowiedz");
  176.                                 break;
  177.                             }
  178.                             case 'b':
  179.                             {
  180.                                 Console.WriteLine("Zla odpowiedz");
  181.                                 break;
  182.                             }
  183.                             case 'c':
  184.                             {
  185.                                 Console.WriteLine("Zla odpowiedz");
  186.                                 break;
  187.                             }
  188.                             case 'd':
  189.                             {
  190.                                 Console.WriteLine("Dobrze!");
  191.                                 break;
  192.                             }
  193.                             default:
  194.                             {
  195.                                 Console.WriteLine("Podaj odpowiedz a, b, c lub d");
  196.                                 break;
  197.                             }
  198.                         }
  199.                     } while (i == 1);
  200.                 }
  201.  
  202.                 if (i == 2)
  203.                 {
  204.                     do
  205.                     {
  206.                         Console.WriteLine();
  207.                         Console.WriteLine("Podaj odpowiedz: ");
  208.                         odp = (char) Console.Read();
  209.                         switch (odp)
  210.                         {
  211.                             case 'a':
  212.                             {
  213.                                 Console.WriteLine("Zla odpowiedz");
  214.                                 break;
  215.                             }
  216.                             case 'b':
  217.                             {
  218.                                 Console.WriteLine("Dobrze!");
  219.                                 break;
  220.                             }
  221.                             case 'c':
  222.                             {
  223.                                 Console.WriteLine("Zla odpowiedz");
  224.                                 break;
  225.                             }
  226.                             case 'd':
  227.                             {
  228.                                 Console.WriteLine("Zla odpowiedz");
  229.                                 break;
  230.                             }
  231.                             default:
  232.                             {
  233.                                 Console.WriteLine("Podaj odpowiedz a, b, c lub d");
  234.                                 break;
  235.                             }
  236.                         }
  237.                     } while (i == 2);
  238.                 }
  239.  
  240.                 Console.ReadKey();
  241.             }
  242.  
  243.             Console.ReadKey();
  244.  
  245.         }
  246.     }
  247. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement