写飞机大战时看到别人代码里有as:和 else goto as;
代码如下
有人知道这是什么用法吗?
帮忙解释下,谢啦
//游戏结束
void Game::GameOver()
{
system("cls");
COORD p1 = { 28,9 };
COORD p2 = { 53,15 };
drawFrame(p1, p2, '=', '|');
SetPos(36, 12);
string str = "Game Over!";
for (int i = 0; i < str.size(); i++)
{
Sleep(80);
cout << str[i];
}
Sleep(1000);
system("cls");
drawFrame(p1, p2, '=', '|');
SetPos(31, 11);
cout << "击落敌机:" << score / 5 << " 架";
SetPos(31, 12);
cout << "得 分:" << score;
SetPos(31, 13);
cout << "获得称号:" << title;
SetPos(30, 18);
Sleep(1000);
cout << "继续? 是(y)| 否(n)";
as:
char x = _getch();
if (x == 'n')
{
exit(0);
}
else if (x == 'y')
{
system("cls");
Game game;
int a = drawMenu(); // 绘制游戏开始界面主菜单
if (a == 2)
game.rank = 20;
system("cls");
drawPlaying(); // 绘制游戏界面框架
game.Playing();
}
else goto as;
}