有两个长度小于30的字符串S1和S2,编写程序,不试用字符串处理函数STRCMP,实现两个字符串的比较.

[复制链接]
查看11 | 回复2 | 2019-10-24 21:20:22 | 显示全部楼层 |阅读模式
代码如下:#include #include int main(){char a[30];char b[30];int t;while (scanf("%s", a) && scanf("%s", b)){t = strcmp(a, b);if (t > 0){printf("%s>%s\n", a, b);break;}else if (t == 0){printf("%s=%s\n", a, b);break;}else{pri...
回复

使用道具 举报

千问 | 2019-10-24 21:20:22 | 显示全部楼层
#include#includeint main(){
char a[32],b[32];int i,j,len1,len2,flag=0;scanf("%s %s",a,b);
len1=strlen(a);
len2=strlen(b);
if(len1...
回复

使用道具 举报

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

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行