Author |
Message |
pwnapple
|
Posted: Tue Jan 24, 2006 3:28 pm Post subject: millionaire game |
|
|
Is this how i should be starting my game?
code: | %Who wants to be a millionaire
%20.01.05
const amt := 2
var questions : array 1 .. amt of string
var answers : array 1 .. amt of string
%data to be stored in datafile
%questions
questions (1) := "1) What best describes ice?"
questions (2) := "2) According to a common phrase, 'There is no place like' what?"
%answers
answers (1) := "Cold"
answers (2) := "Home"
%writes questions to file
var fileNum : int
open : fileNum, "questions.seq", put
for xx : 1 .. amt
put : fileNum, questions (xx)
end for
close : fileNum
|
And if i were to read this file, would i changeopen : fileNum, "questions.seq", put
to
open : fileNum, "questions.seq", get
thx |
|
|
|
|
|
Sponsor Sponsor
|
|
|
person
|
Posted: Tue Jan 24, 2006 5:10 pm Post subject: (No subject) |
|
|
yes |
|
|
|
|
|
person
|
Posted: Tue Jan 24, 2006 5:11 pm Post subject: (No subject) |
|
|
i think the edit button just disapeared on me, but i meant to say u should use read instead of get |
|
|
|
|
|
sylvester-27
|
Posted: Wed Jan 25, 2006 12:54 pm Post subject: (No subject) |
|
|
there is no edit button in the help forum. Also, the program doesn't run. i press run and it finishes execution. might wanna fix that. maybe i have a screwed over computer but it doesn't work. |
|
|
|
|
|
Albrecd
|
Posted: Wed Jan 25, 2006 1:36 pm Post subject: (No subject) |
|
|
The reason it doesn't do anything is because you do not have a file called "questions.seq" on your computer (unless by some really strange coincedence... ) |
|
|
|
|
|
Rasta Fella
|
Posted: Wed Jan 25, 2006 3:13 pm Post subject: (No subject) |
|
|
As a matter of fact...I have recently been doing a "Who Wants To Be A Miliionaire" game for my [FP]. Have a look at it, Link Below:
http://www.compsci.ca/v2/viewtopic.php?t=11161
[mod:7632de6224]
Witch you stole from some one eltes.....
[/mod:7632de6224] |
|
|
|
|
|
Clayton
|
Posted: Wed Jan 25, 2006 3:20 pm Post subject: (No subject) |
|
|
it is the way you should start, however, instead of writing all the questions in the program, just write them all in a seperate editor window and save them there, just makes the program easier to look at, right start though |
|
|
|
|
|
Clayton
|
Posted: Wed Jan 25, 2006 3:21 pm Post subject: (No subject) |
|
|
same for the answers too
god i hate there being no edit button, why isnt there, ne1 know? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Delos
|
Posted: Wed Jan 25, 2006 3:52 pm Post subject: (No subject) |
|
|
Yes. Abuse.
Also, person, I'm curious as to why you favour read: to get: for retrieving file data. I've personally found get: to be the easier of the two - but then that was a very subtle difference and may just be personal preference. |
|
|
|
|
|
Clayton
|
Posted: Wed Jan 25, 2006 3:59 pm Post subject: (No subject) |
|
|
Delos wrote: Yes. Abuse.
abuse in what way |
|
|
|
|
|
[Gandalf]
|
Posted: Fri Jan 27, 2006 10:39 pm Post subject: (No subject) |
|
|
This has been covered many times, use the search button. Makes me think there should be a sticky of all the current 'situations' on compsci "things to know before posting".
It was decided as a prevention for people who were deleting their help topics after recieving help, in which case others can't learn from your questions. Hopefully this issue will be resolved soon. |
|
|
|
|
|
|