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

Username:   Password: 
 RegisterRegister   
 game - function or procedure?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
rainbow-connexion




PostPosted: Sun May 01, 2005 10:40 am   Post subject: game - function or procedure?

hi, i'm making a personality test/game for my end-of-the-year project.. here's how my game works...

there are 20 multiple choice questions. the user chooses only one answer per question.. there are 2-6 choices for each question. Each choice is assigned a number. for example, choice A =1, B= 2, and C=3. The program adds up the numbers and by the 5th question, if the sum has reached a certain number than a sentence or two will be added to the final description. The same will apply even if the sum doesn't reach that number so that each person's description will be different. This process will continue throughout the game. ex.. by the 10th question..by the 15th question. And then finally, the final description.

my question is, would this program be a function or a procedure? and also, what variables would be in the parameters? i think it's a function but i just want to make sure... if anyone could help it'd be appreciated! thanks!
Sponsor
Sponsor
Sponsor
sponsor
arnoct




PostPosted: Sun May 01, 2005 11:53 am   Post subject: (No subject)

Generally, functions are made to return a value. For example, if I wanted to square a number I could use a function which simply returns the value of a number. It's VERY bad programming practice to have a function output data. That's the job of a procedure.

Now, for a program like you're describing, you might not even NEED functions or procedures. It all depends on how you're programming it. The main program you *could* put in a procedure, but it's sort of redundant if all you're going to be doing is calling it once.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: