0

Making a quiz, is there a good way to write a lot of lines?

I am playing around with C# in Visual Studio and want to create a quiz about Game Of Thrones. The thing that annoys me, however, is that my program becomes filled with "Console.WriteLine" commands. It looks messy and is hard to debug. Is there a better way to do this? Could I write all my text into a file and get the data from there easier? Any suggestions are welcome :)

21st Jul 2017, 8:32 AM
Jan Dickow
Jan Dickow - avatar
2 Answers
+ 1
You could do it object based. Create a class that can hold a question and it's answers and methods to access those items. With that you can create "Question objects" Then you can create a second class (maybe static) that holds your Question objects in a list (or array) and with methods to ask your questions and check the answers. So you write your code for questions and answers just once and you can use it again without writing it again. In short: 1 Class to create QuestionObjects (with answers) 1 (static) Class to manage your questions
24th Jul 2017, 7:14 AM
A. Berger
A. Berger - avatar
0
I ended up using an Excel file and then put all the questions and answers in there.
24th Jul 2017, 10:25 AM
Jan Dickow
Jan Dickow - avatar