Author |
Message |
AsianSensation
|
Posted: Fri Jun 13, 2003 3:56 pm Post subject: Newbie question |
|
|
I am just startin to learn C++, and I am using visual studio 6.0. I've been reading some tutorial off the net, and I tried to make a number guesser thingie, except it's not working, and I don't know whats wrong with it. code: | #include <stdlib.h>
#include <iostream.h>
int main ()
{
int num, guess;
num=rand() % 100;
int i=0;
while (i<10);
{
cin >> guess;
if (guess>num)
{
cout<< "High";
i++;
}
else if (guess<num)
{
cout<< "Low";
i++;
}
else
{
cout<< "Yay!, You got it!";
return 0;
}
}
return 0;
} |
so could someone help me? |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
AsianSensation
|
Posted: Fri Jun 13, 2003 5:02 pm Post subject: (No subject) |
|
|
nvm, I fixed it, but I still don't know what was wrong with the other one. |
|
|
|
|
 |
Tony

|
|
|
|
 |
AsianSensation
|
Posted: Fri Jun 13, 2003 5:11 pm Post subject: (No subject) |
|
|
I thought rand() gave u a number between 0 and Rand_Max, but that wasn't the problem, the problem is when I run it, I cannot even input. and I don't know y  |
|
|
|
|
 |
Catalyst

|
Posted: Fri Jun 13, 2003 8:59 pm Post subject: (No subject) |
|
|
asian is right is goes from 0 to RAND_MAX |
|
|
|
|
 |
Homer_simpson

|
Posted: Fri Jun 13, 2003 9:01 pm Post subject: (No subject) |
|
|
when i tried the program... i couldn't even input anything for some reason =/ |
|
|
|
|
 |
SilverSprite
|
Posted: Sat Jun 14, 2003 1:10 pm Post subject: (No subject) |
|
|
Wow no offense to you Asian, but that program is real sloppy! Soo many things wrong with it!! |
|
|
|
|
 |
krishon
|
Posted: Sat Jun 14, 2003 7:51 pm Post subject: (No subject) |
|
|
ezz up on him, he's just beginning |
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
SilverSprite
|
Posted: Sat Jun 14, 2003 10:08 pm Post subject: (No subject) |
|
|
Lol you don't understand... I've showed him a few things, and he's had experience with turing.. tut tut tut asian i'm disappointed. |
|
|
|
|
 |
AsianSensation
|
Posted: Sat Jun 14, 2003 10:24 pm Post subject: (No subject) |
|
|
yeah, i know, i should be ashamed of myself, after all the stuff SilverSprite taught me.....*sob sob  |
|
|
|
|
 |
|