-2
這裏是我在main.m中的所有代碼,只是爲了好玩一個簡單的應用程序。objective c - Break語句不在循環語句或switch語句中
#import <Foundation/Foundation.h>
#import "Game.h"
int main(int argc, const char * argv[])
{
@autoreleasepool {
Game *myGame = [[Game alloc]init];
int response;
bool gameIsRunning = true;
while (gameIsRunning)
{
[myGame instructions];
}
// 5 - Quit option
NSLog(@"\n\nRestart?\n1.Yes\n2.No");
scanf("%i", &response);
if (response==1)
{
NSLog(@"Restarting...");
}
else if (response ==2)
{
break;
}
}
return 0;
}
你能澄清你的問題是什麼嗎? – Andrea
@Andrea:他的頭銜是他的問題... –
對不起,即時通訊非常新,雖然已經解決了,但我只是重新安排我的括號,因爲他們關閉了while循環中的break語句 – Bradley114