Hello, I'm 16 and brand new at C#. Problem is, I want to attempt a program of my own (not a pre-written example), but I don't know what to make. So far, I know how to take input text, how to use integer variables (int, double, etc), how to use if/else statements, basic math (+,-,*,div, %), booleans (>=,==, etc), make the computer print stuff (on screen), escape thingies ( /n, /t, //, etc. lol, thingies), and the +=, *=, etc operators.
What I'm looking for is a suggestion as to what I should make my program do, any input will be greatly appreciated. Thank you in advance.
~Skularach
Loading
Jan MontanoPosted Sep 6, 2007, 11:03 PM
Cheers!
Skularach DeimiosPosted Sep 2, 2007, 10:25 PM
Ryan TurneyPosted Sep 1, 2007, 11:57 AM
Hello and welcome to the world of C#! I'm only a year old than you and I'm glad to see other teens take an interest in programming. Anyways, I too have searched around for your answer and it looks like what you are trying to do is going to be quite difficult. I don't think .NET can read .txt files line by line. For less of a headache try using a SQL Server database or an Access database. To do it with a .txt file - someone correct me if I'm wrong - but I believe you need to create a class that is going to read each line individually (maybe an array?) and then put each one of those lines into a string. From there you need to split the string at each comma (I think you can use Regex for this or I do believe there is a split command available). Once you have that string split apart you should be able to use that info to create the test.
Skularach DeimiosPosted Aug 31, 2007, 1:33 PM
Jan MontanoPosted Aug 30, 2007, 10:34 PM
One approach would be to load all the questions & Answers from the text file into an array or a collection first, so that it will be very easy to access. I assume that you already know how to read the text file.
For the personality test, you need at least 4 fields per question in your text file;
1. question #
2. question
3. followup question if "y" (you only need to store the question #)
4. followup question if "n" (you only need the question #).
With the question # as the primary key per question, you'll be able to know which question to display next if the player answers either "y" or "n".
text file content sample...
1,"Do you have siblings?",2,3
2,"Are you the eldest?",5,6
3,"Are you happy being the only child?",4,5
4,"Do you think it's better to be the only child?",6,7
Skularach DeimiosPosted Aug 30, 2007, 9:43 PM
Skularach DeimiosPosted Aug 30, 2007, 9:29 PM
Jan MontanoPosted Aug 29, 2007, 9:57 PM
Questions and answers will be put in a text file. You have to read the file to post random questions to the user, and verify the answers after.
You could also allow 2 players to play to make it more exciting. Well that's my suggestion =)