You are on page 1of 2

#include <iostream>

#include <cstdlib>
#include <ctime>
#include <iomanip>
using namespace std;
//Beniel Alonso
//83020
//Cesc 2200
//#10 Random Guessing Number
int main()
{
int x, num;
cout << setw(60) << "Random Number Program" << endl;
cout << endl;
cout << "You have to guess from 0 to 100" << endl;
cout << endl;
cout << "Enter a random numer: ";
cin >> num;
srand(time(NULL));
for (int i = 0; i < 100; i++)
{
x = (rand() % (100 - 1 + 1)) + 1;
}
do
{

while (num < x)


{
cout << "Very Low. Please, try again" << endl;
cout << "Enter another randon number" << endl;
cin >> num;
}
while (num > x)
{
cout << "Wow, that's too high" << endl;
cout << "Enter a guessing random number";
cin >> num;
}

} while (num != x);


cout << endl;
cout << "GOOD!! You discovered the number" << endl;
cout << endl;
system("Pause");
return 0;
}
/*Random Number Program
You have to guess from 0 to 100

Enter a random numer : 56


Very Low.Please, try again
Enter another randon number
87
Wow, that's too high
Enter a guessing random number64
Very Low.Please, try again
Enter another randon number
81
Very Low.Please, try again
Enter another randon number
1
Very Low.Please, try again
Enter another randon number
2
Very Low.Please, try again
Enter another randon number
50
Very Low.Please, try again
Enter another randon number
100
Wow, that's too high
Enter a guessing random number90
Wow, that's too high
Enter a guessing random number80
Very Low.Please, try again
Enter another randon number
82
Very Low.Please, try again
Enter another randon number
83
Very Low.Please, try again
Enter another randon number
84
Very Low.Please, try again
Enter another randon number
85
Very Low.Please, try again
Enter another randon number
86
GOOD!!You discovered the number
Press any key to continue . . .*/

You might also like