#include#include#include#include "conio.h"void main() {int year=0,month=0,day=0,hour=0,mintue=0,second=0; printf("Input the day you tell your trues:(Year-Mou-Day-Hour-Min-Sec,default for 0):\n"); scanf("%d-%d-%d-%d-%d-%d",&year,&month,&day,&hour,&mintue,&second); system("cls"); time_t now,trues,toget; while(1) {struct tm truest = {second,mintue,hour,day,month-1,year-1900};now = time(NULL); trues=mktime(&truest); printf("now is %s\n",ctime(&now)); printf("the day you tell your trues:%s\n",ctime(&trues)); toget = (now-trues)/3600/24;
printf("days together:%d\n",toget);
toget = (now-trues)/3600;
printf("hours together:%d\n",toget);
toget = (now-trues)/60;
printf("mintues together:%d\n",toget);toget = (now-trues); printf("seconds together:%d\n",toget); _sleep(1000);
system("cls"); }}祝你成功
|