Somebody helped me that i should change the char[] to string, but I am still having problem comparing the strings imputed by the user. I am not sure if I have to use fstream or something else. getline did not really help me since it shows errors depending on what it is inside the getline.
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');
}
This declares a new variable named
countryof typefstream. Probably not what you want.You should try:
instead. And you have the same issue with
name.Also:
better call
breakdirectly.And:
should probably be:
cin >> choice;