用C++ 编写一个程序,提示用户输入两个字符串,然后比较这两个字符串是否相等。

[复制链接]
查看11 | 回复2 | 2009-4-7 19:05:34 | 显示全部楼层 |阅读模式
求教了

回复

使用道具 举报

千问 | 2009-4-7 19:05:34 | 显示全部楼层
#include using namespace std;void main(){char a[100];char b[100];cout > a;cout > b;if (strcmp(a, b) == 0)cout using namespace std; int main() {string str1,str2; cout>str1; cout>str2; if(st...
回复

使用道具 举报

千问 | 2009-4-7 19:05:34 | 显示全部楼层
主要步骤stringstr1;stringstr2;cin>>str1>>str2;if(str1 == str2)
.......string类型是可以直接比较是否相等的...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行