#include <stdlib.h>
#include <time.h>
//#include <dos.h>
#include <conio.h>
int main()
{
struct tm *curtime
time_t t
clock_t start
double th_hour,th_min,th_sec
do
{
printf("*********************************************
")
printf("** This is a simple clock program.**
")
printf("** **
")
printf("*********************************************
")
printf("The current time is:
")
t=time(0)
curtime=gmtime(&t) /*得到当前系统时间*/
if((double)curtime->tm_hour<=12) /*午前的处理*/
{
printf("AM ")
if((double)curtime->tm_hour<10) printf("0") /*十点之前在小时数前加零*/
printf("%.0f:",(double)curtime->tm_hour)
}
else /*午后的处理*/
{
printf("PM ")
if((double)curtime->tm_hour-12<10) printf("0")
printf("%.0f:",(double)curtime->tm_hour-12)
}
if((double)curtime->tm_min<10) printf("0")
printf("%.0f:",(double)curtime->tm_min)
if((double)curtime->tm_sec<10) printf("0")
printf("%.0f",(double)curtime->tm_sec)
printf("
")
start=clock()
while(clock()-start<1000)
//delay(1000) /*延时一秒后刷新*/
system("cls")
}while(!kbhit())/* 按任一键退出 */
return 0
}
{// .................
while(t == 0) {
a1 = (float)getdata1()*3.3/1024
a2 = (float)getdata2()*3.3/1024
a0 = (float)getdata0()*3.3/1024
printf("d0 = %.2f d1 = %.2f d2 = %.2f\r",a0,a1,a2) // '\r'
sleep(1)
}
pthread_join(p_m,&retval)
return 0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)