大家看看这个时间提醒器为什么错了,该怎么改

来源:百度知道 编辑:UC知道 时间:2024/06/07 23:58:15
代码如下:
// 时间提醒器.cpp : Defines the entry point for the application.
//

#include "stdafx.h"

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.
SYSTEMTIME t;
GetLocalTime(&t);
if(t.wDayOfWeek==1)MessageBox(Null,"今天是星期天","时间提醒器",0);
else if(t.wDayOfWeek==2)MessageBox(Null,"今天是星期一","时间提醒器",0);
else if(t.wDayOfWeek==3)MessageBox(Null,"今天是星期二","时间提醒器",0);
else if(t.wDayOfWeek==4)MessageBox(Null,"今天是星期三","时间提醒器",0);
else if(t.wDayOfWeek==5)MessageBox(Null,"今天是星期四","时间提醒器",0);
else if(t.wDayOfWeek==6)MessageBox(Null,"今天是星期五","时间提醒器",0);
else if(t.wDayOfWeek==7)MessageBox(Null,"今天是星期六","时间提醒器

NULL全部要大写
而且星期天是0,不是1,没有7

星期天是0,而且你这个完全可以用switch;
MessageBox(NULL,"今天是星期X","时间提醒器",MB_OK);

Null改为NULL,星期以0开始。