码迷,mamicode.com
首页 > 其他好文 > 详细

字符串比对

时间:2018-03-01 11:53:17      阅读:158      评论:0      收藏:0      [点我收藏+]

标签:cstring   blog   ring   name   字符串   ios   str1   pac   div   

#include<iostream>  
#include<cstring>  
  
using namespace std;  
  
int main(){  
    char str1[11],str2[11];  
    int type;  
    cin>>str1;  
    cin>>str2;  
    if(strlen(str1)!=strlen(str2)) cout<<"1";  
    else{  
        if(!strcmp(str1,str2)) cout<<"2";  
        else if(!strcmpi(str1,str2)) cout<<"3";  
        else cout<<"4";  
    }  
    cout<<endl;  
    return 0;  
}  

 

字符串比对

标签:cstring   blog   ring   name   字符串   ios   str1   pac   div   

原文地址:https://www.cnblogs.com/zhangshuyao/p/8487134.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!