Computer Science Canada Question game |
Author: | SwAnK [ Sun Mar 06, 2005 12:47 pm ] |
Post subject: | Question game |
hello all, I'm new here and have a question regarding turing. I want to create a question game using turing. A question is asked, and then 4 multiple choice answers are given. At the end I want it to sya how many oyu got right, and the percentage. Then ask if you want to play again. IF so, then the score would have to be reset back to 0. Can any one help me?? thanx |
Author: | person [ Sun Mar 06, 2005 1:43 pm ] |
Post subject: | |
look at if statements |
Author: | Tony [ Sun Mar 06, 2005 2:33 pm ] | ||
Post subject: | |||
|
Author: | SwAnK [ Sun Mar 06, 2005 5:07 pm ] |
Post subject: | |
Thanx, that will really help. My main problem though is asking a multiple choice question and if they pick the right letter, then it adds 1 to the count and contiues on. and if their wrong it continues on anwyas until all the questions are answered. Would that work with an if statment? if answer = "a" then count +=1?? I was thinking of making a boolean type since they are either wrong or write with the letter they chose. thanx again |
Author: | person [ Sun Mar 06, 2005 6:23 pm ] |
Post subject: | |
yes it will work |
Author: | Cervantes [ Sun Mar 06, 2005 6:57 pm ] |
Post subject: | |
If there are going to be lots of questions or if you want to make the questions easily customizable, and you want to cut down the # of lines your program is, you should look into getting information from files. Check the tutorial section, search for the one by Dan. |
Author: | SwAnK [ Mon Mar 07, 2005 10:45 pm ] |
Post subject: | |
I cant find that turtorial, but thanx anyways, Ive written the game out, and it says your score and everything. Now i would like to add something else to it. How would you ( in one consecutive run of the prgogram, without closing it) be able to store like the last 5 scores, so it would come up with something simple like, "previous scores of this game were 3, 5, 4, 1, 2? would it be along the lines of before the score gets erased and reset back to 0, it is stored in another variable alreayd declared? And would you have to create like 5 of these storage variables, or is there some simpliar other way to do it???? |
Author: | jamonathin [ Tue Mar 08, 2005 10:05 am ] |
Post subject: | |
if your talking about a high score, go look in tutorials |
Author: | Token [ Tue Mar 08, 2005 11:59 am ] | ||||||
Post subject: | |||||||
you could use two arrays, use one to keep the name and another to keep the score it would look somthing like this
the thing is it looks a little messy when you output the scores, you might want to align it in columns or somthing and also you could sort the arrays to make it like a real top scores list. another thing u might want it to do is display the scores at the end of each game, to do that move the score part inside the loop and... change this
To this
-Enjoy |
Author: | person [ Tue Mar 08, 2005 3:29 pm ] |
Post subject: | |
file IO |
Author: | Token [ Tue Mar 08, 2005 3:36 pm ] |
Post subject: | |
Quote: file IO
it could be done through file IO but he said he just wanted it so that it would work through the loop so a array would suffice. in case you would like to create a new file to hold the scores heres a link http://www.compsci.ca/v2/viewtopic.php?t=5340#70478- Specifically for High Score lists http://www.compsci.ca/v2/viewtopic.php?t=6818#66063- General file I/O |
Author: | Cervantes [ Tue Mar 08, 2005 8:26 pm ] | ||
Post subject: | |||
Token wrote: you could use two arrays, use one to keep the name and another to keep the score it would look somthing like this
Better yet, use a flexible array of a record. That way, you an array of 'objects' (contestants, in this case) and their name and score is stored.
P.S. I just choked on a mouthful of chile while typing. I had an explosive cough, and couldn't get my hands up in time. Needless to say, my keybaord doesn't look so white anymore. |
Author: | Token [ Tue Mar 08, 2005 8:30 pm ] |
Post subject: | |
lol i'm sorry for your keyboard Cervantes and thanks a lot for your help, i checked it out and i understand what you mean now |
Author: | SwAnK [ Tue Mar 08, 2005 8:38 pm ] |
Post subject: | |
AHAHA, yes that is too bad for your keyboard. And thank you all for your help. I have completed the game, it works perfectly, thank you. Could you also explain to me about the flexible array? it sounds interesting. |
Author: | Token [ Wed Mar 09, 2005 3:48 pm ] |
Post subject: | |
okay a providing that you already know what an array is, well a flexable array is just a 2-d array (an array within an array) that has 2 different types , string and integer for example, but Cervantes would probibly be able to tell you about it better than me |
Author: | Flikerator [ Wed Mar 09, 2005 3:57 pm ] |
Post subject: | |
With a flexible array you can change the upper bounds (Not sure about lower) of the array. Very handy once you read the tutorial (See tutorial section). Also a little offtopic, whats does I/O stand for? |
Author: | person [ Wed Mar 09, 2005 4:00 pm ] |
Post subject: | |
flikerator : its short for File Input and Output token : wtf?? their completely different things |
Author: | Token [ Wed Mar 09, 2005 5:30 pm ] |
Post subject: | |
Quote: wtf?? their completely different things
well then you explain it because thats how i understood it |
Author: | Flikerator [ Wed Mar 09, 2005 5:54 pm ] |
Post subject: | |
person wrote: flikerator : its short for File Input and Output
token : wtf?? their completely different things Alright thanks. I know how to fix errors I get with them but I didn't know what it meant ^^; So thanks |
Author: | person [ Wed Mar 09, 2005 5:57 pm ] | ||||||
Post subject: | |||||||
2D arrays: arrays that r within an array for example:
there is 1 to 20 in every one of the 1 to 10 stored (hard to explain) flexible array : these r arrays that u can change the upper bounds of such as:
u can chang it by calling
this changes the upper bound of a to 20 putting them together u can also have a flexible 2D array |
Author: | Token [ Wed Mar 09, 2005 6:17 pm ] |
Post subject: | |
lol see i learned something new, i got confused between record arrays and 2d arrays, thanks for clearing that up |