While loop condition not working correctly.

The while loop part of my program isn't working right. stringOriginal is an array. If a large amount of characters passed the max 80 im processing is typed, it goes into a infinite loop.
Also the condition doesn't work i type in quit and the loop continues.
if someone could please point me in the right direction with an answer or a link explaining why its not working I would appreciate it greatly. Thanks

while(stringOriginal != "quit"){
std::cout << "Enter a string of characters you would like to reverse\n";

cin.getline(stringOriginal,79,'\n');


}
You can't compare C strings using == because that just compares the pointers, and will only return true if the two points to the same memory location. Use std::strcmp to compare the strings.

If you used std::string to store your strings you could have used ==.
Topic archived. No new replies allowed.