How to compare string with const char*?

前端 未结 6 1172
灰色年华
灰色年华 2021-02-19 06:51
#include 
#include 
#include 
#include 
using namespace std;
int main()
{
        string cmd;
        whil         


        
6条回答
  •  北恋
    北恋 (楼主)
    2021-02-19 07:15

    The condition in your while will never evaluate to true because you're testing to check the cmd string is equal to "exit" and "\\exit". One string can never be equals to two values at the same time.

提交回复
热议问题