Hey im pretty new to C# and im just learning it and i want to make a game, more of a test but i dont know how i would make it. so there is going to be yes or no question and multiple answers and i wouldent know were to start if you can show me or write the code that would be GREAT! p.s i know how to do it using BAT Files but i see theres alot of difference in if statements. help please. thanks.

3 Years
Discussion Span
Last Post by JOSheaIV

Well there are two approaches, the first is you could do a console application. For this you would have a collection of question, and display one at a time and wait for a user's response of "YES" or "NO" (watch your case-sensative checking there). Then as they enter their answer and press the enter key you move onto the next question (you could also but some check to make sure they entered a valid answer). This assumes you don't let them go back and change their answer.

The other approach is a Windows Form application. Are you familiar with these at all? And do you have an IDE you can work it? (Makes it a lot easier, like Visual Studio). Anyway for this if you didn't need it to be dynamic, you could create a collection of components with a Label that holds the questions and then 2 Radio Buttons (in a GroupBox or TableLayoutPanel), one yes, and one no. Then they select the answers as they choose and press a button at the end for like submit answers or something.

Those are just some basic ideas on how you might go about approaching it

Quick side note, if you know about them, you could make UserControl in the form example as a template for each question (so it would have the label and radio buttons). That would help the design easier (then if you really wanted to have fun have a TableLayoutPanel on the main form and add the custom controls to them programmically, offering a dynamic approach). Of course, if you are new to the whole thing you might want to avoid this for now (they are just what I have been messing with a lot lately)


We do not write your code for you; you have to do that. What this forum is for is to help you when you get stuck. Post the code you have pointing out where it stopped behaving properly and we will give you some advice.

There are lots of examples of that kind of problem on-line. You might want to get your self a book on writing C# programs and work your way through that. That might give you some ideas on how to tackle this kind of challenge.


This would also be a good time to learn about classes and object oriented programming. These will not only streamline your code for this project but will be of great help to any future projects. In fact you will probably be better off forgetting most of what you learned using .bat files. A search in this or any of the many forum sites will help.

Edited by tinstaafl


I second most of what @tinstaafl says. Learning OOP and classes is a priceless trait, one that you will developer over time (I think I am still improving on it and I've been coding C# for probably 5-6 years).

That being said, I wouldn't say forget what .bat's have tought, but more, don't try to apply much of it in C# (in otherwords, those still maybe valuable in other areas, but C# not so much, along with other OOP).

Quick question what other languages have you worked in? Java? C? C++?


Thanks alot guys i looked up some tutorials and ive learnt so much on if statements and stuff. got my game half finished and once again thanks.
and i did abit of java back in the day. so i still know alot about the languages.
so far the only coding languages ive done is C# Java and a tiny bit of python. i was trying to find out what language fits me and i think c# does so thanks for helping guys love the site. peace.


Well that's good to hear (C# is pretty awesome, I really will only ever code in it ... that and SQL, but that's for work).

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.