int Start()
{
TCHAR s[] = _T("是否生成数字波?"), s1[] = _T("> 是"), s2[] = _T("> 否");
int choice = 0, i = 0;
initgraph(800, 700);
setbkcolor(BLACK);
settextcolor(WHITE);
settextstyle(70, 50, _T("Consolas"));
outtextxy(25, 200, s);
settextstyle(40, 20, _T("Consolas"));
outtextxy(300, 400, s1);
outtextxy(300, 500, s2);
while (1)
{
MOUSEMSG M = GetMouseMsg();
if (M.x >= 300 && M.x <= 380 && M.y >= 400 && M.y <= 440)
{
i = 1;
settextcolor(RED);
outtextxy(300, 400, s1);
if (M.mkLButton)
{
choice = 1;
break;
}
}
else if (M.x >= 300 && M.x <= 380 && M.y >= 500 && M.y <= 540)
{
i = 1;
settextcolor(RED);
outtextxy(300, 500, s2);
if (M.mkLButton)
{
choice = 0;
break;
}
}
else if (i)
{
settextcolor(WHITE);
outtextxy(300, 400, s1);
outtextxy(300, 500, s2);
}
}
return choice;
}
int main()
{
while (Start() == 1)
{
Handle();
}
closegraph();
return 0;
}
主函数里的while循环,第一次运行到这儿的时候会显示Start子函数创造的界面,获取鼠标点击,但是第二次运行到这儿的时候就不会显示Start子函数代表的界面,直接显示Handle子函数创造的界面了,但是在while和Handle语句分别设置断点调试的时候,就没问题