[attach]7385[/attach]
楼主的编译环境是TC2.0吗 ?我下了试着运行,怎么提示有一个错误啊?

浮躁的世风中,我开始在编程中寻找乐趣
楼主的编译环境是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;
}
哎,算是改过来了,谢谢楼主的提醒
这个又不行~~~~~~~~~~
敢问斑竹哥哥!!那你认为什么是有用的啊!!你又学到多少你认为有用的东西啊?不要把话说的太绝,世上没有绝对的东西(包括真理 !)!我们学程序设计第一个动机就是喜欢而已,喜欢是学习东西的动力!(否则谁愿意整天和那些英文符号打交道啊!)
建议楼主在整点时弄出点响声来(嘟…嘟…嘟…嘟…嘟…嘟…)
最后一响频率要高些,达1000Hz好了。