Write your question here.
|
cout << "Enter your guess: ";
|
#include "stdafx.h"
#include <iostream>
#include <ctime>
#include "targetver.h"
using namespace std;
int main()
{
int iGumballs;
int iUserguess;
int iGuesses = 0;
while (true);
system("CLS");
cin.clear();
iGuesses = 0;
srand(static_cast<unsigned int>(time(0)));
iGumballs = rand() % 1000 + 1;
cout << "How many gumballs are in the gumball jar, you guess"
<< endl;
do;
cout << "Enter your guess: ";
cin >> iUserguess;
if (iUserguess > iGumballs);
cout << "Too High!" << endl << endl;
if (iUserguess < iGumballs);
cout << "Too Low!" << endl << endl;
iGuesses++;
while (iUserguess > iGumballs || iUserguess < iGumballs);
cout << "You guess the right amount of gumballs! High Five" <<
endl << endl;
cout << "You took" << iGuesses << " guesses " << endl << endl;
system("PAUSE");
return 0;
}
I was watching a youtube video and copying what the guy did for practice and I can't figure out how to figure that code.
I have two errors:
Error 1 error C2059: syntax error : 'if'
2 IntelliSense: expected 'while'
Thank you for your help.