Hello,
Next problem.
Im now trying this piece
Code:
int input_games()
{
string home_team , away_team, score_home_team, score_away_team ;
do
{cout<< "Home team :";
getline(cin,home_team);
cout<< "Away team :";
getline (cin,away_team);
cout<< "Score home team :" ;
getline (cin, score_home_team);
cout<< "Score away team :";
getline (cin, score_away_team);
if (strlen(home_team))!=0 && strlen(away_team)!=0 && strlen(score_home_team)!=0 && strlen(score_away_team!=0) {
cout<<"You have forgotten to fill in all the fields";
cin.get{}; }
while ( strlen(home_team)!=0 && strlen(away_team)!=0 && strlen(score_home_team)!=0 && strlen(score_away_team)!=0);
}
}
But the debugger says that the if is wrong.
What's a better way to look if a user has made a input.
I get now this messages
Code:
C:\Users\wobben\Desktop\toernooi\toernooi\main.cpp||In function 'int input_games()':|
C:\Users\wobben\Desktop\toernooi\toernooi\main.cpp|20|error: cannot convert 'std::string' to 'const char*' for argument '1' to 'size_t strlen(const char*)'|
C:\Users\wobben\Desktop\toernooi\toernooi\main.cpp|20|error: expected primary-expression before '!=' token|
Roelof