|
#include <iostream>
#include <ctime>
using namespace std;
int main(void)
{
struct tm *ptr;
time_t t;
do
{
t = time(NULL);
ptr = localtime(&t);
cout << ptr->tm_hour <<":" << ptr->tm_min << ":" << ptr->tm_sec;
sleep(1000); //这个sleep是dos中的.linux没有.怎么改?
}while(1);
return 0;
} |
|