I apologize, the topic of this thread has nothing to do because this post was started about a parse/syntax error but I solved it on my own and now this is something else, hopefully simple!
I have this function that goes like this
void er(void)
{
string erbase[] ={"parl", "chant", "dans", "ferm"}; //french verb base
string ertrans[] ={"to talk", "to sing", "to dance", "to close"}; //english translation 1
string eralttrans[]={"to speak", " ", " ", " "}; //englsh translation 2
int r = rand()%4;
cout << "The verb "<<erbase[r]<<"er means ";
char ans[16];
cin.getline(ans,16);
if((ans==ertrans[r])||(ans==eralttrans[r]))
{
cout << "Good!";
}
}
int main(int nNumberofArgs, char* pszArgs[])
{
cout <<
"This program is to be used as tool for learning french verbs. A french verb in\n"
"the infinitive form will be randomly chosen. You will be asked to translate the\n"
"infinitive form into english, and to conjugate the french verb into the present,"
"imperative, past (passe compose), imperfect, future, and conditional tenses.\n"
"It is important to read the 'READ ME' file before continuing.\n\n"
"Have you read the 'READ ME' file? (Enter Y for yes or N for no.) ";
char yesno;
cin >> yesno;
int exit = YesNo(yesno); //I have another function referenced here that works fine.
if(exit==0){return(0);}; //This kicks them out if they haven't read the 'README' :)
cout << endl;
for(;;){er();}; //I know this is infinite loop, I will add constraints later.
system("PAUSE");
return(0);
}
The output looks like
This program is to be used as tool for learning french verbs. A french verb in
"the infinitive form will be randomly chosen. You will be asked to translate the
"infinitive form into english, and to conjugate the french verb into the present,
"imperative, past (passe compose), imperfect, future, and conditional tenses.
"It is important to read the 'READ ME' file before continuing.
"Have you read the 'READ ME' file? (Enter Y for yes or N for no.) Y //This output is from YesNo()
The verb parler means The verb parler means to speak
Good!The verb danser means to dance
Good!The verb chanter means
The blue is my input.
So my questions are:
Why does it print double the first time?
Also, I don't want the "Good!" on the next line, I think it's got something to do with cin.getline(), but I'm not sure. Any help?