在Dos C 下运行的C语言程序怎样转变为windows C 程序

下面是用C语言编写的在DOS C下能运行的秒表程序,请问高手怎样把它转化为简单的Windows C程序?急!急

#include <stdio.h>
#include <time.h>
#include <dos.h>
struct time tim;
int h0,m0,s0,h1,m1,s1,h2,m2,s2;
main()
{ char ch=0;
clrscr();
printf("Press any key to start time!");
getch();
gettime(&tim);
h0=tim.ti_hour;
m0=tim.ti_min;
s0=tim.ti_sec;
h1=m1=s1=0;
gotoxy(70,1);
printf("%2d:%2d:%2d\n",h1,m1,s1);
printf("Esc key by the end of time!");
while (ch!=27)
{ while(!bioskey(1))
{ gettime(&tim);
if (s2==tim.ti_sec) continue;
h2=tim.ti_hour;
m2=tim.ti_min;
s2=tim.ti_sec;
s1=s2-s0;
if (s1<0) { s1+=60;m2--;}
m1=m2-m0;
if (m1<0) { m1+=60;h2--;}
h1=h2-h0;
if (h1<0) h1=0;
gotoxy(70,1);
printf("%2d:%2d:%2d\n",h1,m1,s1);
gotoxy(20,2);
}
ch=bioskey(0);
}
}

这个是我写的:

#include <stdio.h>
#include <time.h>
#include <conio.h>

int main()
{
int a[4] = {0}, i;
clock_t ms, prev;

ms = CLOCKS_PER_SEC/67;
prev = clock();
printf("Press any key to start the timer...");
getch();
for(i = 0; i < 100; ++i)putchar('\b');
printf("Press ctrl+c to end the timer... \n");
while(1) {
if((clock() - prev) > ms) {
prev = clock();
++a[0];
}
printf("%02d:%02d:%02d:%02d", a[3], a[2], a[1], a[0]);
for(i = 0; i < 11; ++i)
putchar('\b');
for(i = 0; i < 4; )
if(a[i] == 60) {
a[i] = 0;
++a[++i];
} else break;
}
return 0;
}
温馨提示:内容为网友见解,仅供参考
第1个回答  2013-12-14
如果是代码-->exe
编译就行了
如果你是说win界面
你可以用windows.h画
但我也白,不会
你还是百度吧
第2个回答  2013-12-14
哈哈,这个不好实现,c是没有界面的,只能把c执行成.exe的文件
相似回答