// demonstrates usage of time function // Mikhail Nesterenko // 9/16/2009 #include #include using std::cout; using std::cin; using std::endl; int main(){ // prints out current time int currentTime = time(NULL); cout << currentTime << " seconds has passed since 00:00 hours of January 1, 1970\n"; // measures time it take user to intput an integer int int1; do{ int from = time(NULL); cout << "Enter positive integer (0 to quit): "; cin >> int1; int to = time(NULL); cout << "It took you " << (to - from) << " seconds to enter " << int1 << endl; }while (int1 > 0); }