How to compare string with const char*?

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


        
6条回答
  •  独厮守ぢ
    2021-02-19 07:17

    strcmp returns 0 when they are equal. So I think you want != 0

    Surely strcmp won't return 0 for both, because it can't be equal to both.

    Also it looks like you have a backslash at the start of your string, you should escape that with a double backslash.

提交回复
热议问题