请高手解决C问题

来源:百度知道 编辑:UC知道 时间:2024/05/22 06:29:28
#include <iostream>
#include <iomanip>
#include <string>
#include <ctime>

using namespace std;

void showtime(tm* pt)
{
cout<<setfill('0')<<1900 + pt->tm_year<<'-';
cout<<setw(2)<<pt->tm_mon + 1<<'-';
cout<<setw(2)<<pt->tm_mday<<' ';
cout<<setw(2)<<pt->tm_hour<<':';
cout<<setw(2)<<pt->tm_min<<':';
cout<<setw(2)<<pt->tm_sec<<'\n';
}

int main()
{
time_t t = time(NULL);
tm* pt = localtime(&t);
int sec = pt->tm_sec;
showtime(pt);
while(1)
{
t = time(NULL);
pt = localtime(&t);
if(sec != pt->tm_sec)
{
sec = pt->tm_sec;
syste

你给的程序不全,没法给你调试
d:\program files\vc98\include\iosfwd(23) : error C2146: syntax error : missing ';' before identifier '_Fpz'
少';'号
d:\program files\vc98\include\iosfwd(23) : error C2734: 'fpos_t' : const object must be initialized if not extern
必须初始化
d:\program files\vc98\include\iosfwd(23) : fatal error C1004: unexpected end of file found
文件创建意外中止