Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Saving Elements of a Program
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
josh




PostPosted: Tue May 18, 2004 7:52 pm   Post subject: Saving Elements of a Program

I am making a homework helper software that allows you to make up your own mutliple shoice or true and false quizes to practice on. However I do not know how you would be able to make it so the user can load a previous quiz they made (i.e. save he data they tyoped in so it can be added to and used later).

Can n e one plz explain to me how to do this? Would u use the read write commands??????
Sponsor
Sponsor
Sponsor
sponsor
Paul




PostPosted: Tue May 18, 2004 8:10 pm   Post subject: (No subject)

Well, u figure out how u wanna load the file from a text file, then arrange it so that an fitting output format that would put all the stuff inside the right variables when u load it.
josh




PostPosted: Tue May 18, 2004 8:58 pm   Post subject: (No subject)

who in the what now????(I am a real nooooob) Question
beedub




PostPosted: Tue May 18, 2004 9:12 pm   Post subject: (No subject)

you could allow the user to name the file, by getting what they input and using File.New or whatever to create the file as they called it. Then you could allow the user to input questions and the 4 possible answer for each. then you put that info into the previousily named file.
using : open: varName, "nameoffile.txt",put or whatever. then if the user wishes to use it again. you ask the user at the beginning of the program if they wish to use a previousily made file, and if so, they must type in the exact file name.
josh




PostPosted: Wed May 19, 2004 7:31 pm   Post subject: (No subject)

but in the text file how would I be able to save what the user put the write answer as being. (I am making the program so that when the user puts in the 4 possible answers it will randomize the order they are in to mix up the correct and incorrect.) so how can I make the program load and have the correct answer marked so they can answer the question Question
SuperGenius




PostPosted: Thu May 20, 2004 4:06 pm   Post subject: (No subject)

make a text file with this syntax:

question
correct answer (will be one of: a/b/c/d)
answer a
answer b
answer c
answer d

question
correct answer
answer a
answer b
answer c
answer d

and keep doing this over and over. Have the program collect information in a loop into a flexible array, this way it will be easy to add more questions. in the loop say:
code:

get question(count)
get corrans(count)
get a(count)
get b(count)
get c(count)
get d (count)


perhaps you could use a for loop for this application but i dont know because i've never had to use one in conjuction with a flexible array.
there is a good tutorial which covers flexible arrays I think if you need to know stuff.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: