flyacrossawave
Solid State Member
- Messages
- 13
I am having trouble with char stings. I attempt to create loops where the loop ends when the char variable becomes a certain string. For example:
This loop does not end after my entering "quit", it simply produces the text of the cout statement again no matter what input is given. My compiler is Dev-C++ Version 4.
Any help in this matter would be greatly appreciated.
Code:
#include <iostream.h>
int main()
{
char toquit[100];
cout << "Enter 'quit' to exit" << endl;
while (toquit != "quit")
{
cin >> toquit;
cout << "The program should still be running during this loop."
<< endl;
}
char response;
cin >> response;
return 0;
}
This loop does not end after my entering "quit", it simply produces the text of the cout statement again no matter what input is given. My compiler is Dev-C++ Version 4.
Any help in this matter would be greatly appreciated.