用户登录网站,通常需要注册,一般需要输入两遍密码。请编程判断输入的两次密码是否一致,一致输出“same”,不一致输出“different”
#include <stdio.h>
#include <string.h>
int main()
{
char a[100],b[100];
while(scanf("%s %s",a,b) != EOF)
{
int i;
int flag = 0;
for(i=0;(a[i] !='\0')||(b[i]!='\0');i++)
{
if(a[i] != b[i])
{
flag = 1;
break;
}
}
if(flag == 1)
printf("different\n");
else
printf("same\n");
}
return 0;
}
#include <stdio.h>
(737)#include <string.h>
int main()
{
char str1[105],str2[105];
scanf("%s %s",str1,str2);
int len1=strlen(str1),len2=strlen(str2);
int flag=1;
if(len1!=len2) flag=0;
else{
int i,j;
for(i=0,j=0;i<len1&&j<len2;i++,j++){
if(str1[i]!=str2[j]){
flag=0;
break;
}
}
}
if(flag) printf("same\n");
else printf("different\n");
} #include <stdio.h>
#include <string.h>
int main()
{
char s1[16];
char s2[16];
while(scanf("%s %s", &s1, &s2) != EOF)
{
if(strcmp(s1, s2) == 0 )
printf("same\n");
else
printf("different\n");
}
return 0;
}
import java.util.*;
public class Main{
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String str = scanner.nextLine();
String[] strings = str.split(" ");
if (strings[0].contains(strings[1])){
System.out.println("same");
}else {
System.out.println("different");
}
}
} # include<bits/stdc++.h>
using namespace std;
int main()
{
char password1[20];
char password2[20];
cin >> password1 >> password2;
if(strcmp(password1,password2)==0)
cout << "same\n";
else
cout << "different\n";
return 0;
} import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner input=new Scanner(System.in);
String s1=input.nextLine();
String[] a=s1.split(" ");
if(a[0].equals(a[1]))
System.out.println("same");
else
System.out.println("different");
}
}
#include <stdio.h>
#include <string.h>
int main()
{
char pass1[20],pass2[20];
scanf("%s %s",&pass1,&pass2);
if(strcmp(pass1,pass2)==0) printf("same");
else printf("different");
return 0;
} import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
String[] str = sc.nextLine().spilt(" ");
if(str[0].equals(str[1])){
System.out.println("same");
}else{
System.out.prtinln("different");
}
}
}