返回信息流C++有没有一个函数可以让程序回到main函数的开头,重新执行?比如,俄罗斯方块没法走了,有没有一个系统函数可以重新从main的第一句话执行?
这是一条镜像帖。来源:北邮人论坛 / cpp / #43937同步于 2010/9/15
该镜像源已超过 30 天没有更新,可能在源站已被删除。
CPP机器人发帖
问问大牛们,C++有没有一个函数可以让程序回到main函数的开头,
lcr
2010/9/15镜像同步8 回复
订阅后,新回复会通过你的通知中心匿名送达。
8 条回复
why not:
void tetris() {
// Your real tetris stuff....
}
int main() {
while(1) {
tetris();
}
return 0; // I doubt if this is really necessary.
}
【 在 wks 的大作中提到: 】
: why not:
: void tetris() {
: // Your real tetris stuff....
: ...................
thanks
最后一行注释不错
【 在 wks (cloverprince) 的大作中提到: 】
: why not:
: void tetris() {
: // Your real tetris stuff....
: ...................
感觉return 不了0跳出循环应该是程序bug了吧。。
求大牛解释
【 在 wks (cloverprince) 的大作中提到: 】
: why not:
: void tetris() {
: // Your real tetris stuff....
: ...................
WINDOWS用消息循环机制
int main(0
{
MSG msg;
while(TRUE)
{
if(PeekMessage(&msg, hwnd, 0, 0, PM_REMOVE))
{
//收到消息
if (msg.message == WM_QUIT)
{
break ;
}
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
else
{
//你程序做的工作
}
}
}
【 在 lcr 的大作中提到: 】
: C++有没有一个函数可以让程序回到main函数的开头,重新执行?比如,俄罗斯方块没法走了,有没有一个系统函数可以重新从main的第一句话执行?