判断输入的两个字符串是否相等(顺序不是问题,只要字符相等就可以)
程序代码:
#include<stdio.h> #include<string.h> #include<stdlib.h> void Sort(char a[]); int main() { int i = 0; char *a = malloc(50); char *b = malloc(50); scanf("%s",a); scanf("%s",b); if(strlen(a)!=strlen(b)) { printf("No\n"); } Sort(a); Sort(b); if(strcmp(a,b)); printf("YES\n"); else printf("NO\n"); return 0; } void Sort(char a[]) { int i,j; char c; for(i=0;i<strlen(a)-1;i++) { for(j=0;j<strlen(a)-i;j++)//先排序// { if(a[j]>a[j+1]) { c=a[j]; a[j]=a[j+1]; a[j+1]=c; } } } }
error C2181: illegal else without matching if
E:\71.c(34) : warning C4018: '<' : signed/unsigned mismatch
E:\71.c(36) : warning C4018: '<' : signed/unsigned mismatch一直是这样的错误