Guess Number Game
Code:
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main(int argc, char** argv)
{
system("TITLE Guess My Number.");
system("COLOR 5");
srand(static_cast<unsigned int>(time(0)));
int iMyNumber;
int iYourNumber;
int iPoints = 5;
while(true)
{
cin.clear();
iMyNumber = rand() % 100 + 1;
cout << "You start with 5 points, each spin cost 1 point." << endl;
cout << "Guess my Number '1 - 100'" << endl;
cout << "Get as many points as you can!" << endl;
do
{
cout << "Enter your Number ";
cin >> iYourNumber;
iPoints += -1;
if (iYourNumber > iMyNumber)
cout << "Too high!" << endl << endl;
else if (iYourNumber < iMyNumber)
cout << "Too low!" << endl << endl;
} while (iYourNumber != iMyNumber);
cout << "Correct!" << endl << endl;
cout << "You've got " << iPoints << " points." << endl << endl;
cin.get();
}
return 0;
}








