小编arz*_*eth的帖子

如何将字符串与const char*进行比较?

#include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <string.h>
using namespace std;
int main()
{
        string cmd;
        while(strcmp(cmd.c_str(),"exit")==0 && strcmp(cmd.c_str(),"\exit")==0)
        {
                cin>>cmd;
                cout<<cmd;
        }
        return 0;
}
Run Code Online (Sandbox Code Playgroud)

我被卡住了.

c++

13
推荐指数
3
解决办法
4万
查看次数

标签 统计

c++ ×1