1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83:
| using System; using System.Collections.Generic; using System.Linq; using System.Text;
namespace Quiz { class Program { static void Main(string[] args) { Console.WriteLine("Willkommen zu meinem Quiz."); Console.WriteLine("Ich hoffe ihr habt Spaß und seid erfogreich."); Console.WriteLine("Um deine Antwort einzugeben wähle den jeweiligen Buchstaben."); Console.WriteLine("Um dies Antwort zu bestädigen drücke Enter.");
List<Frage> fragen = new List<Frage>(); fragen.Add(new Frage("Was ist das neueste Betriebssystem von Microsoft?", new List<string>(new string[] { "Win Vista", "Win 2000", "Win 7" }), "C")); fragen.Add(new Frage("Wer war erster Bundeskanzler der BRD?", new List<string>(new string[] { "Konrad Adenauer", "Theodor Heuss", "Angela Merkel" }), "A")); fragen.Add(new Frage("Von wem stammt das Lied Heal the World?", new List<string>(new string[] { "Elvis Presley", "Micheal Jackson", "Mearaya Carey", "Britney Spears" }), "B")); fragen.Add(new Frage("Welche Reaktion findet auf der Sonne statt?", new List<string>(new string[] { "Kernspaltung", "Kenrschmelzung", "Photosynthese" }), "B")); fragen.Add(new Frage("Kernspaltung bedeutet...", new List<string>(new string[] { "das zusammenbringen von Atomkernen", "die spaltung von Atomkernen", "die nutzbarmachung des Sonnenwindes", }), "B")); fragen.Add(new Frage("Wie viele Mitglieder hat die EU", new List<string>(new string[] { "10", "25", "27", "32" }), "C")); fragen.Add(new Frage("Wie viele Mitglieder hat der Bundestag", new List<string>(new string[] { "20 + Überhangmandate", "300 + Überhangmandate", "598 + Überhangmandate", "895 + Überhangmandate" }), "C")); fragen.Add(new Frage("Welcher Verein ist noch nie aus der 1. Bundesliga abgestiegen", new List<string>(new string[] { "FC Bayern", "Hamburger SV", "Borrusia Dortmund", "Schalke 04" }), "B")); fragen.Add(new Frage("Was ist EINE Nuss?", new List<string>(new string[] { "Kokosnuss", "Erdbeere", "Erdnuss", "Kiwi" }), "B")); fragen.Add(new Frage(".", new List<string>(new string[] { ".", ".", ".", "." }), "A"));
foreach (Frage frage in fragen) { if (frage.StelleFrage()) { Console.WriteLine("Richtige!"); }
else { Console.WriteLine("Falsch!"); } } }
class Frage { string m_fragetext; List<string> m_antworten; string m_antwort;
public Frage(string _fragetext, List<String> _antworten, string _antwort) { m_fragetext = _fragetext; m_antworten = _antworten; m_antwort = _antwort; }
public bool check(String _userAntwort) { return m_antwort.ToLower() == _userAntwort.ToLower(); }
public bool StelleFrage() { Console.WriteLine("{0}", m_fragetext); char antwortindex = 'A'; foreach (string antwort in m_antworten) { Console.WriteLine("{0} ) {1}", (Char)(antwortindex++), antwort); } Console.Write("Antwort: "); string userantwort = Console.ReadLine(); return check(userantwort);
} }
} |