Hello, I have been spinning wheels for hours now. I have a great foundation for my solution but I do not know how to enter in the language and then output from the array.
The premise is taking a list of 10 english and comparing them against french words, there are 10 of each. When my translation of the words works. what I cannot accomplish getting out of my while loop. It reads out my translation, but then it sits there waiting for me to put in another word. When I type in the french word it translates to English again, but still waiting for me to enter another word to translate. how can I easily get out of this loop so I may get back out to a choice input screen. I am reading in the words like this:
i je
you vous
am suis
are etes
happy heureux
sad triste
hot chaud
cold froid
but mais
This is the for while loop I cannot get out of:
1 2 3 4 5 6
while(cin.peek() != 0) {
cin >> french;
for (i = 0; i < 10; i++)
if (!strcmp(french, FrenchArray[i]))
cout << " " << EnglishArray[i];
}
How do I get out without testing for cin >> french
get.line??
I know peek is incorrect
Thank you
I have a working program. But for some reason I cannot exit properly. I keep getting warning codes. I know i'm just missing something easy from working on this for so long.
These are the error codes i'm getting:
Unhandled exception at 0x104cee04 in languageTranslator.exe: 0xC0000005: Access violation writing location 0x108e6bf0.
There is no source code available for the current location.
As well as an End Now prompt for my solution.
I have both ways I have tried to get out. the comments out was other option I thought would work. This is the end of my do-if-else.
Thank you again!