Computer Science Canada

millionaire game

Author:  pwnapple [ 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

Author:  person [ Tue Jan 24, 2006 5:10 pm ]
Post subject: 

yes

Author:  person [ Tue Jan 24, 2006 5:11 pm ]
Post subject: 

i think the edit button just disapeared on me, but i meant to say u should use read instead of get

Author:  sylvester-27 [ Wed Jan 25, 2006 12:54 pm ]
Post 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.

Author:  Albrecd [ Wed Jan 25, 2006 1:36 pm ]
Post 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... Shocked )

Author:  Rasta Fella [ Wed Jan 25, 2006 3:13 pm ]
Post 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]

Author:  Clayton [ Wed Jan 25, 2006 3:20 pm ]
Post 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

Author:  Clayton [ Wed Jan 25, 2006 3:21 pm ]
Post subject: 

same for the answers too
god i hate there being no edit button, why isnt there, ne1 know?

Author:  Delos [ Wed Jan 25, 2006 3:52 pm ]
Post 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.

Author:  Clayton [ Wed Jan 25, 2006 3:59 pm ]
Post subject: 

Delos wrote:
Yes. Abuse.

abuse in what way

Author:  [Gandalf] [ Fri Jan 27, 2006 10:39 pm ]
Post 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.


: