|
Post by speedyclock on Jan 23, 2011 17:13:52 GMT
#include <IOSTREAM> #include <string> #include <cmath> #include <cstdlib>
int main() { //Set up namespace and variables using namespace std; int answer; int number; double per = 0.01; cout << "Guess a number game!" << endl; srand(time(0)); number = rand(); number = number * per; do { cin >> answer; if (answer < number) cout << "Too Low" << endl; else if (answer > number) cout << "Too High" << endl; else cout << "Perfect!" << endl; } while (answer != number); system("pause"); return 0; }
Go ahead and guess!
|
|