/**************************************************************** Copyright (C) : University of Michigan Project: ENG101/200 - Class example File: rand0.cpp Purpose: An example of the rand() function Compiler: g++ Programmer: Alex Bielajew Start Date: 09/28/10 ****************************************************************/ /* Remarks: The same sequence is produced every time this program is run. */ //File: rand0.cpp #include #include #include // Need this for the rand() function using namespace std; int main(void) { // 0 <= Random numbers (int) <= RAND_MAX cout << "RAND_MAX = " << RAND_MAX << "\n\n"; cout << "The first 10 random numbers are...\n"; for(int i = 1; i <= 10; i = i + 1) cout << "Random number " << setw(2) // Nice output on i << i << " = " << rand() // Random int between 0 and RAND_MAX incl. << "\n"; return 0; }