do while関数内でいくつかのコードを実行しようとしています:
do {
printf("\nThis game has two different modes: I Guess, You Guess\n");
Sleep(2000);
printf("Which mode do you want to play?\n");
cin >> mStr;
cout << "Are you sure you want to play " << mStr << " mode?";
cin >> choice;
} while (choice != "No");
ただし、mStr(char配列)に入るたびに、再起動するだけです。それはcoutさえ実行しません。
呼び出されるchar配列は次のとおりです。
char mStr[10];
char choice[4];
ちなみに、coutの代わりにprintf()を使用するにはどうすればよいですか?私はなしで練習しようとしています。
編集:
新しいコードは次のとおりです。
do {
printf("\nThis game has two different modes: I Guess, You Guess\n");
Sleep(2000);
printf("Which mode do you want to play?\n");
cin >> mStr;
printf("Are you sure you want to play %s mode?", mStr); //Cuts off here and doesnt display the 'Guess' part of I Guess
cin >> choice;
} while (strcmp(cKey, choice) != 1);