Trying to create a program to test if a word entered is a palindrome and if not to loop back for a secondary prompt. Using Visual C++ 2010, it runs with no error, but it infinitely loops the "Enter word:" prompt without pausing for the cin. My instructor looked over the code and is as confused as I am. The base program was done before, this is to add a loop to it. I've tried several different loop styles and they all wouldn't work, this one does but only loops the first cout.
A) Take out stdafx.h and it gives an error
B) The only problem with the program is with the loop itself, it's only looping the first line after the while, it works with char just fine so didn't want to change it.
C) I used the int for simplicity of the coding and it works just fine for me
D) Care to elaborate just which brackets I'm forgetting?
E) I used the system ("pause") to make it pause without terminating immediately upon code completion when running from the debug option.
like i said... there is a setting in vs that lets you remove it. i understand char[]s arent the problem. i said why are you using them when you included <string> and std::string works so much better than char[].
c) i understand it works fine... i never said it didnt. im saying use bool. that is what it is meant for. using int over bool for simplicity makes no sense, because bool is "simpler"
d) the brackets for the while loops... if you dont understand what i mean i suggest taking another look at loops. scroll down to while: http://www.cplusplus.com/doc/tutorial/control/
e) i understand what system(pause) does. i said it shouldnt be used. there are better ways of pausing.
also, line 29 is pointless, and i wouldnt use using namespace std. rather using std::object or std::object_when_called. and beyond those brackets, i never said any of your code was [b]wrong[b]. i just said there are better more c++ ways of doing it