I am trying to make a program that takes file input from something in Latin "EcceGratum.txt" and then prompts the user for English (in this case), comparing it to that line of "EcceGratumEnglish.txt" storing both of these values in respective arrays. I then use a while loop with if and else inside of it, to increment only if the strings match, and if they don't, merely display the english, and then prompt the user to input it again after clearing the screen. Unfortunately, I keep getting a "correct" response when it's not. A few other problems too.
Your code works OK for me. (As I don't know Latin I used French.)
Andy
(tweaked code so it didn't clear screen to make flow clearer for checking.)
un
one
correct
deux
three
wrong
two
try again!
deux
four
wrong
two
try again!
deux
two
correct
trois
three
correct
quatre
six
wrong
four
try again!
quatre
seven
wrong
four
try again!
quatre
four
correct
cinq
five
correct
I get an error saying, Error: identifier "max" is undefined. I'm using Microsoft Visual C++ Express. I have no idea why the program doesn't want to read string. Does it go until the null character? Maybe the input file doesn't have a null character at the end of every line. I suppose I could enter one.
It must have been indirectly included when I built with the GCC( compiler (I've edited my earlier post accordingly.)
Maybe the input file doesn't have a null character at the end of every line. I suppose I could enter one.
It doesn't have or need any null characters in the file. nulls are only needed when their stored in memory (so you can find the end of the string.) So don't try to add any.