18信科2龚思佳


私信TA

用户名:uq_33103784766

访问量:16453

签 名:

等  级
排  名 206
经  验 6264
参赛次数 7
文章发表 121
年  龄 0
在职情况 学生
学  校
专  业

  自我简介:

#include <iostream>

#include<cstring>

#include<cmath>

using namespace std;


int main()

{

    char str1[10],str2[10];

    cin>>str1;

    cin>>str2;

    int len1=strlen(str1);

    int len2=strlen(str2);

    if(len1!=len2){

        cout<<"1"<<endl;

    }

    

    else{

        int i,j;

       for(i=0;i<len1;i++){

            if(str1[i]!=str2[i])

                break;

    }/*if(strcmp(str1,str2)==0)

        cout<<"2"<<endl;*/

     if(i==len1){

        cout<<"2"<<endl;

     }

     else{

        for(j=0;j<len1;j++){

            if(abs(str1[j]-str2[j])!=0&&abs(str1[j]-str2[j])!=32)

                break;

        }

        if(j==len1)

        cout<<"3"<<endl;

     else

        cout<<"4"<<endl;

    }

    }




    return 0;

}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换万能编程问答  

代码解释器

代码纠错

SQL生成与解释

  评论区