how to exit nested loops

后端 未结 6 1161
予麋鹿
予麋鹿 2021-01-21 20:11

i have something like

   while(playAgain==true)
   {
      cout<<\"new game\"<

        
6条回答
  •  走了就别回头了
    2021-01-21 20:49

    This solution is specific to your case. When the user's decision is 'n', he doesn't want to play again. So just set playAgain to false and then break. Outer loop will be broken automatically.

    while(playAgain==true){
       cout<<"new game"<

提交回复
热议问题