/*****************************************************************/ /* Author: Chang */ /* Aim for: CS135 class */ /* Problem: A program demonstrating predefined functions. */ /*****************************************************************/ //preprocessor directives #include #include //required for srand () and rand () functions #include //required for time () function. using namespace std; int main () { int num; //Seed the random number generator. //Only need to be called ONCE in the whole program. srand ( time (NULL)); //Assigning the randomly generated number to variable num. //num will be within the range of [1, 100] num = rand () % 100 + 1; cout << "The first number generated is: " << num << endl; //Assigning the randomly generated number to variable num. //num will be within the range of [1, 100] num = rand () % 100 + 1; cout << "The second number generated is: " << num << endl; //Assigning the randomly generated number to variable num. //num will be within the range of [1, 100] num = rand () % 100 + 1; cout << "The third number generated is: " << num << endl; system("PAUSE"); return 0; }