I'm new to programming and was trying to do a simple counting program from an
online tutorial. Copied the syntax down exactly but I get errors every time I
attempt to compile it. Here is a log of the errors and below that is a copy of
the script. I'm just not sure what I'm doing wrong exactly. Tried correcting
the errors and was still getting errors messages. : /
35 C:\Gumballs.cpp expected primary-expression before '<<' token
39 C:\Gumballs.cpp expected while' before numeric constant
39 C:\Gumballs.cpp expected(' before numeric constant
39 C:\Gumballs.cpp expected )' before ';' token
40 C:\Gumballs.cpp expected}' at end of input
while' before numeric constant
39 C:\Gumballs.cpp expected
)' before ';' token
40 C:\Gumballs.cpp expected
using namespace std;
int iGuesses = 0;
iGuesses = 0;
iGumballs = rand()%1000+1;
cout << "How many Gumballs are in the jar?"
cout << "Enter your guess: ";
cin >> iUserguess;
if(iUserguess > iGumballs)
cout << "Too High!" << endl << endl;
if(iUserguess < iGumballs)
cout << "Too Low!" << endl << endl;
while(iUserguess > iGumballs || iUserguess < iGumballs);
cout << "You are right" ; << endl << endl;
cout << "You took " << iGuesses << " guesses" << endl << endl;
Nevermind. I fixed the problem.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.