Advertisement
MBrendecke

Untitled

Nov 14th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2.  
  3. using static System.Console;
  4.  
  5. namespace Sandbox.Intelligenztest
  6. {
  7.     internal class Program
  8.     {
  9.         private static string ChooseLanguage()
  10.         {
  11.             Clear();
  12.             SetCursorPosition(45, 0);
  13.             ForegroundColor = ConsoleColor.Blue;
  14.             WriteLine("Intelligenztest/Intelligence test");
  15.             SetCursorPosition(5, 2);
  16.             WriteLine("Wählen Sie ihre Sprache/Choose your language");
  17.             SetCursorPosition(5, 3);
  18.             WriteLine("a: Englisch/English");
  19.             SetCursorPosition(5, 4);
  20.             WriteLine("b: Deutsch/German");
  21.             SetCursorPosition(5, 5);
  22.             Write("Sprache/language: ");
  23.             return ReadLine();
  24.         }
  25.  
  26.         private static string[] Quiz(int language)
  27.         {
  28.             string[,] questions =
  29.             {
  30.                 { "Continue the sequence: 3-6-9-12-?", "Setze die Folgende Zahlenreihe fort: 3-6-9-12-?" },
  31.                 { "What doesn't fit?", "Was passt nicht?" },
  32.                 { "Continue the sequence: 2-3-5-8-12-?", "Setze die Folgende Zahlenreihe fort: 2-3-5-8-12-?" },
  33.                 { "Continue the sequence: 2-5-11-23-47-?", "Setze die Folgende Zahlenreihe fort: 2-5-11-23-47-?" },
  34.                 { "What doesn't fit? 4; 5; 6; 8;", "Was passt nicht? 4; 5; 6; 8;" }
  35.             };
  36.  
  37.             string[,] possibleAnswers =
  38.             {
  39.                 { "16", "22", "15", "14", "16", "22", "15", "14" },
  40.                 { "Monitor", "Keyboard", "Mouse", "Cat", "Bildschirm", "Tastatur", "Maus", "Katze" },
  41.                 { "18", "20", "14", "17", "18", "20", "14", "17" },
  42.                 { "18", "20", "14", "17", "18", "20", "14", "17" },
  43.                 { "8", "4", "5", "6", "8", "4", "5", "6" }
  44.             };
  45.  
  46.             string[] answers = new string[questions.GetLength(0)];
  47.  
  48.             for (int i = 0; i < questions.GetLength(0); i++)
  49.             {
  50.                 int y = 3;
  51.                 SetCursorPosition(5, (i * 7) + y++);
  52.                 WriteLine($"{(char)('1' + i)}. {questions[i, language]}");
  53.  
  54.                 for (int letter = 0; letter < 4; letter++)
  55.                 {
  56.                     SetCursorPosition(10, (i * 7) + y++);
  57.                     WriteLine($"{(char)('a' + letter)}: {possibleAnswers[i, (language * 4) + letter]}");
  58.                 }
  59.                 Write((language == 0) ? "The answer is: " : "Die Antwort ist: ");
  60.                 answers[i] = ReadLine();
  61.                 SetCursorPosition(5, (i * 7) + ++y);
  62.                 WriteLine("===================================================");
  63.             }
  64.  
  65.             return answers;
  66.         }
  67.  
  68.         private static void Main(string[] args)
  69.         {
  70.             int Punkte = 0;
  71.  
  72.             string Sprache = "";
  73.  
  74.             do
  75.             {
  76.                 Sprache = ChooseLanguage().Trim().ToLower();
  77.             } while (Sprache != "a" && Sprache != "b");
  78.             Clear();
  79.  
  80.             Quiz(Sprache == "a" ? 0 : 1);
  81.  
  82.             SetCursorPosition(5, 39);
  83.             if (Punkte == 5)
  84.             {
  85.                 ForegroundColor = ConsoleColor.Green;
  86.                 WriteLine("Sie haben {0} von 5 Punkten erreicht", Punkte);
  87.                 SetCursorPosition(5, 40);
  88.                 Write("Super Leistung!", Punkte);
  89.  
  90.             }
  91.  
  92.             if (Punkte == 4 || Punkte == 3)
  93.             {
  94.                 ForegroundColor = ConsoleColor.Yellow;
  95.                 WriteLine("Sie haben {0} von 5 Punkten erreicht", Punkte);
  96.                 SetCursorPosition(5, 40);
  97.                 Write("Gut gemacht, doch das geht noch besser!", Punkte);
  98.             }
  99.             else if (Punkte < 3)
  100.             {
  101.                 ForegroundColor = ConsoleColor.Red;
  102.                 WriteLine("Sie haben {0} von 5 Punkten erreicht", Punkte);
  103.                 SetCursorPosition(5, 40);
  104.                 Write("Schlechte Leistung!", Punkte);
  105.             }
  106.  
  107.             ReadKey();
  108.  
  109.         }
  110.     }
  111. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement