public static void NewUserQuestion() { Console.WriteLine("Pose a question:"); string userquestion = Console.ReadLine(); Console.WriteLine("Give possible answers, separate them by a comma:"); string useranswers = Console.ReadLine(); string[] useranswersseperated = useranswers.Split(","); Console.Write(useranswers); Console.WriteLine("Type in the number of the RIGHT answer:"); int usercorrect = Convert.ToInt32(Console.ReadLine()); Quizelement quizelement3 = new Quizelement { question = userquestion, answers = useranswersseperated, correct = usercorrect }; foreach (var item in quizelement3.answers) { Console.WriteLine(item.ToString()); } Console.WriteLine(quizelement3.question + Environment.NewLine + useranswers + Environment.NewLine + quizelement3.correct); }
static void Main(string[] args) { bool continuequiz = false; while (!continuequiz) { Quizelement.showQuiz(); Console.Write("Do you want to continue the quiz? Yes/No. || To add your own Questions type add" + Environment.NewLine); if (Console.ReadLine() == "add") { Quizelement.NewUserQuestion(); continuequiz = true; } else if (Console.ReadLine() == "Yes") { continuequiz = true; } else { continuequiz = false; } } }