-2
이 게임에서는 플레이어가 이름을 쓰길 원합니다. 그러나 컴퓨터가 단지 이름을 받아들입니다. 어떻게해야합니까?C++ 2 cinch.getline after echader
입력 : 게임 밥에 에 오신 것을 환영하고, 이제 컴퓨터 둘 중 하나 선택 : 밥 는
출력 결혼. 선택된 하나가 게임을 잘
#include<cstring>
#include<iostream>
using namespace std;
int main(){
int choose;
cin>>choose;
if(choose==1){
char name1[30],name2[30];
cout<<"Hi player 1\nWhat's your name?\n";
cin.getline(name1,30);
cout<<"Hi player 2\nWhat's your name?\n";
cin.getline(name2,30);
cout<<"Welcome to the game"<<name1<<"and"<<name2<<"Now the Computer chooses one of you.The chosen one will start the game\n\n";
}
내 대답을 확인하고 알려주세요. –
다시 확인해 주시겠습니까? cin 부분을 잊어 버렸습니다. –