0
누군가 내가 char[]
을 string
으로 변경해야한다는 것을 도와 주었지만 여전히 사용자가 입력 한 문자열을 비교하는 데 문제가 있습니다. 나는 fstream
또는 다른 것을 사용해야하는지 잘 모르겠습니다. getline
은 getline 내부의 내용에 따라 오류를 표시하므로 실제로 도움이되지 않았습니다.C++에서 문자열 비교
void search (competitor competitors[], int broi)
{
string country;
string name;
char choice;
bool flag;
do{
cout << "\n\n Input Country: " << endl;
fstream country;
cout << " Input name: " << endl;
fstream name;
flag = false;
for(int i=0; i<count; i++)
{
if(country==competitors[i].country && name==competitors[i].name)
{
cout << "found one" << endl;
flag = true;
}
}
if (flag == false)
cout << " New search (Y/N)?: ";
cin >> izbor;
}while(choice == 'Y' || choice == 'y');
}
는 또한, 외부'문자열 country' 및 country' fstream'내부가있다. 'name '과 같은 것. – chris
@chris : 예, 그렇기 때문에 'fstream country'는 어떤 이유로 국가를 지정하는 것이 임시적인 것이라고 생각합니다. –