怎么判断手动输入的字符串和给定的宏常量是否相等 比如给定#define password c123456
然后我让用户输入一串字符 那么如何判断该字符串和password是否相等呢
判断手动输入的字符串和给定的宏常量是否相等
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
4条回答 默认 最新
技术专家团-Plio大咸鱼 2022-02-28 20:03关注直接用等号即可
#include <iostream> using namespace std; #define password "abc123" int main(int argc, char const *argv[]) { string s; cin >> s; cout << s << endl; cout <<( s == password); }
有帮助望采纳~本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报