How to compare string with const char*?

前端 未结 6 1909
一生所求
一生所求 2021-02-19 06:20
#include 
#include 
#include 
#include 
using namespace std;
int main()
{
        string cmd;
        whil         


        
6条回答
  •  隐瞒了意图╮
    2021-02-19 07:16

    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.

提交回复
热议问题