void prov(list<Glosor> lista)
{
string testet;
int santal = 0;
int rsvar = 0;
list<Glosor>::iterator it;
for(it = lista.begin(); it != lista.end(); it++){
cout << (*it).svenska << " betyder på engelska: "; // *it writes the swedish word for translate.
getline(cin, testet); //Here you write the english word and "if" function test if it's correct.
if(testet == (*it).engelska){
cout << "Ratt svar!\n";
rsvar++;
}
else{
cout << "Tyvärr fel svar rätt svar är: "<< (*it).engelska) << endl; // Here i use "it" to write the correct answare if you guess wrong. But it keep telling me "error: expected ';' before ')' token"
}
santal++;
}
cout << "Du hade " << rsvar << " rätt svar av " << santal << " möjliga" << endl;
}
Are you saying you don't see that there's a closing parenthesis in line 15 after engelska that doesn't have a matching opening parenthesis? You need to code some more, I guess. Get more practice.
Also in the FOR loop @ line 7, use ++it instead of it++. The former doesn't create a copy of the iterator, meaning it performs faster.