Thread: C++ Help
View Single Post
Old 06-28-2009, 05:54 PM   #10 (permalink)
Oreo
 
*^[#@"'.,;:\|/:;,.'"@#]^*

Join Date: Dec 2006

Location: Leicester, England

Posts: 3,657

Oreo will become famous soon enoughOreo will become famous soon enough

Send a message via MSN to Oreo
Default Re: C++ Help

Quote:
Originally Posted by Baez View Post
The reason being NEVER USE GOTO. I'm not mad but I had to make it stand out. :laughing:

Goto statements are the worst and laziest method of C++ programming and should never be used. Use function calls instead. Can you post the "cin" code you were trying to use so I can debug it?

printf works using a variable parameter list. If you don't know what that is I can explain it. Basically it's a function or object that can accept any number of arguments.

EDIT: kmote got to it first
Heh, don't worry i know not to use them. The guy says in the book they're lazy and rarely work, but you should atleast understand how they work. So just so i understood i tried to put them into the program.

But nevermind, i don't really care why the cin >> statements didn't work 'cus i'll never be using goto anyway

Hehe.. my first console based game is underway It's just based on stuff i've learnt so far. An RPG game where you choose where to go, get randomly attacked, stat increases etc

edit:
GAH WTF ! :mad:

If i'm correct this code:

num1 = rand() % 11;

will create a random number between 1 and 10. Therefor the following code:

if(num1 > 6) { code code code code etc }

should execute theoretically 3/10 times ? But it doesn't. I've ran the app like 30 times and everytime a random number 6 or under appears to of been generated..

Last edited by Oreo; 06-28-2009 at 05:57 PM.
Oreo is offline