#include <iostream>
#include <stdlib.h>
#include <time.h>
using namespace std;
int main()
{
srand((int)time(NULL));
//use const for upper and lower bound
const int upperLimit = 100;
const int lowerLimit = 1;
int guessNumber = 0;
int theCount = 0;
int myRandomNumber = 0;
do {
int myRandomNumber = (rand() % (upperLimit - lowerLimit + 1)) + lowerLimit; //Generate a random number
cout << myRandomNumber << endl;
//Begin loop
cout<< endl << "Enter a number: ";
cin >> guessNumber;
cout <<endl << "You have entered " << theCount << "integers."; //Enter user's guess
}while (guessNumber != myRandomNumber);
{ if (guessNumber > myRandomNumber);
cout << "Too High, Try Again!"; //Display message
if (guessNumber < myRandomNumber);
cout << "Too Low, Try Again!"; //Display message
} // End loop
guessNumber == myRandomNumber;
// Display message and exit loop
cout << "You've guessed wisely! ";
cout << endl;
// Display number of guesses
cout << "The number was " " it took you " " guesses.";
cout << endl;
cout << "The number was " " you gave up after " " guesses.";
cout << endl;
//Stop
return 0;
}
oh and please ignore the whitespace and indents I have'nt made it look nice just yet LOL;)
** Edit **
here are the 2 errors
Error 1 error C2144: syntax error : '__w64 unsigned int' should be preceded by ';' c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h 19
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int c:\program files\microsoft visual studio 9.0\vc\include\codeanalysis\sourceannotations.h 19
This post has been edited by Gmoney93079: 19 September 2009 - 09:40 PM

New Topic/Question
Reply



MultiQuote





|