#include <iostream>
using std::cout;
using std::cin;
int main()
{
unsigned int t0, t1;
int n;
t0 = time(NULL);
cout << "Please input an integer -- ";
cin >> n;
t1 = time(NULL);
cout << t1 - t0 << " seconds has elapsed.\n";
return 0;
}
#include <iostream>
#include <cstdlib>
using std::cout;
using std::endl;
int main()
{
srand(time(NULL));
for (int i=0; i<10; ++i)
cout << rand() % 6 << endl;
return 0;
}
The program may run as follows:
|
The flowchart of the program: |