C++倒计时怎样添加窗口类

来源:百度知道 编辑:UC知道 时间:2024/06/17 07:20:42
这段代码
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

void wait ( int seconds )
{
clock_t endwait;
endwait = clock () + seconds * CLK_TCK ;
while (clock() < endwait) {}
}

void main(){
time_t rawtime;
struct tm * target_time;
int d,h,m,s;
int k=0;
long double dif,r;
time_t now,t_end; // in sec

/* get current timeinfo and modify it to the user's choice */
time ( &rawtime );
target_time = localtime ( &rawtime );

// time struc and to time_t
target_time->tm_year = 2008 - 1900; //year - 1900
target_time->tm_mon= 8 - 1; // month - 1
target_time->tm_mday = 8 ; // day
target_time->tm_hour = 8 ; // hour
target_time->tm_min = 1 ;
target_time->tm_sec = 1 ;
t_end = mktime (target_time);
// printf("%s ",ctime(&t_end)); //print and check

whi

啥窗口类啊。
你这是控制台应用程序啊。想要窗口得用WinMain函数的。
你可以创建的时候创建一个MFC应用程序的!

生成EXE文件的话你build一下就在DEBUG目录下有可执行程序了 !

创建MFc的应用程序然后把这代码添加进去,MFC不是很难网上搜索一下使用教程吧,

创建一个MFC类 然后在OnC...View函数里添加你的代码 编译后
exe文件在你的工程目录里的debug文件里