When the compiler gets here:
outFile1<<"The highest number is "<<maxnum<<", and it is located at coordinates "<<maxX<","<<maxY<<"."<<endl;
it gives the error
invalid operands of types const char[2]' and
int' to binary `operator<<'
When the compiler gets here:
outFile1<<"The highest number is "<<maxnum<<", and it is located at coordinates "<<maxX<","<<maxY<<"."<<endl;
it gives the error
invalid operands of types const char[2]' and
int' to binary `operator<<'
As others have correctly pointed out, you have an '<' rather than '<<' in the middle of your expression. Because '<<' binds more tightly than '<', you essentially have two sub-expressions to a '<':
outFile1<<"The highest number is "<<maxnum<<", and it is located at coordinates "<<maxX
Which is fine, and:
","<<maxY<<"."<<endl
which is obviously attempting to apply operator << to a const char[2] and an integer in the first instance. Hence the slightly odd compiler error which c++ is rightly famous for.