#include <stdio.h>
#include <stdlib.h>
int main()
{
char strA[30], strB[30];
int i, lenA=0, lenB=0;
for (i=0 ; i<30 ; i++){
strA[i] = '\0';
strB[i] = '\0';
}
printf("input the string A: ");
gets(strA);
printf("input the string B: ");
gets(strB);
i=0;
while (strA[i] != '\0'){
lenA++;
i++;
}
i=0;
while (strB[i] != '\0'){
lenB++;
i++;
}
if (lenA != lenB)
printf("string A and string B are different.\n");
else{
for (i=0 ; i<lenA ; i++){
if (strA[i] != strB[i]){
printf("string A and string B are different.\n");
break; // break of line34 'for' and go to line40
}
else if(i == (lenA-1)){
printf("string A and string B are the same.\n");
}
}
}
system("pause");
return 0;
}