#include
#include
#include
#include
using namespace std;
int main()
{
string cmd;
whil
After fixing a couple of small bugs, this works on my machine:
#include
#include
#include
#include
#include
int main()
{
std::string cmd;
while( std::strcmp(cmd.c_str(),"exit")!=0
&& std::strcmp(cmd.c_str(),"\\exit")!=0)
{
std::cin>>cmd;
std::cout<
However, I wonder why you want to use std::strcmp()
at all. As you have just found out, it's not as easy to use as the std::string
class. This
while(cmd!="exit" && cmd!="\\exit")
works just as well, is easier to understand, and thus easier to get right.