// 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(nullptr); cout << currentTime << " seconds has passed since 00:00 hours of January 1, 1970\n"; // measures time it take user to intput an integer int input; do{ const int from = time(nullptr); cout << "Enter positive integer (0 to quit): "; cin >> input; const int to = time(nullptr); cout << "It took you " << (to - from) << " seconds to enter " << input << endl; }while (input > 0); }