#include #include using namespace std; int main() { // Print 5 random numbers from 0 to 49 // always prints the same random numbers int guess; int myRandom = rand() % 10; // computer random # cout << endl << "The secret # is: " << myRandom << endl; cout << "Enter a number between 0 and 10: "; cin >> guess; // user enters number cout << endl; if (guess == myRandom) { cout << "You got it right"; } else { cout << "Wrong" << endl; } for(int i = 0; i<5; i++ ) { int myRandom = rand() % 50; cout << " " << myRandom; } cout << endl; // To get different random numbers, use "srandom" to seed the // random number generator with the current time in seconds. srandom (time (0)); // This prints different random numbers each time. for (int i = 0; i<5; i++) { cout << i << random() % 10 << " "; } return 0; }