[attach]7385[/attach]
楼主的编译环境是TC2.0吗 ?我下了试着运行,怎么提示有一个错误啊?
浮躁的世风中,我开始在编程中寻找乐趣
楼主对图形方面挺有研究,
感觉挺好,
俺可是一窍不痛的,
写了比楼主简单100倍的时钟
#include "stdio.h"
#include "conio.h"
#include "stdlib.h"
typedef struct
{
int hour;
int minute;
int second;
} mytime;
int main()
{
long one,two;
char ch;
mytime atime;
printf("Please input the time now:");
scanf("%d%*c%d%*c%d",&atime.hour,&atime.minute,&atime.second);
while(1)
{
if(atime.hour==24)
atime.hour=0;
if(atime.minute>59)
{
atime.minute%=60;
atime.hour++;
}
if(atime.second>59)
{
atime.second%=60;
atime.minute++;
}
one=clock();
do
{
two=clock();
}while(two-one<18); /*这个数随机器调*/
atime.second++;
if(kbhit())
{
ch=getch();
if(ch=='q')
break;
else
printf("time for now is %02d:%02d:%02d\n",atime.hour,atime.minute,atime.second);
}
}
return 0;
}
有错
#include "stdio.h"
#include "conio.h"
#include "stdlib.h"
typedef struct
{
int hour;
int minute;
int second;
} mytime;
int main()
{
long one,two;
char ch;
mytime atime;
printf("Please input the time now:");
scanf("%d%*c%d%*c%d",&atime.hour,&atime.minute,&atime.second);
while(1)
{
if(kbhit())
{
ch=getch();
if(ch=='q')
break;
else
printf("time for now is %02d:%02d:%02d\n",atime.hour,atime.minute,atime.second);
}
atime.second++;
if(atime.second>=60)
{
atime.second%=60;
atime.minute++;
}
if(atime.minute>=60)
{
atime.minute%=60;
atime.hour++;
}
if(atime.hour==24)
atime.hour=0;
one=clock();
do
{
two=clock();
}while(two-one<18);
}
return 0;
}
哎,算是改过来了,谢谢楼主的提醒
这个又不行~~~~~~~~~~