回复 10楼 B_soldier
我的想法是:进入循环i=0,如果str1[0]=' ',那么while自动i++,i=1,然后判断str1[1],以此类推
程序代码:#include<stdio.h>
#include <string.h>
void main()
{
char str1[80],str2[80];
int i;
i=0;
while((str1[i++]=getchar())!='\n')
{
if(str1[i-1]>='a' && str1[i-1]<='z')str1[i-1]-=32;
if(str1[i-1]==' ')i--;
}
str1[i]=0;
i=0;
while((str2[i++]=getchar())!='\n')
{
if(str2[i-1]>='a' && str2[i-1]<='z')str2[i-1]-=32;
if(str2[i-1]==' ')i--;
}
str2[i]=0;
if(strcmp(str1,str2))printf("NO\n");
else printf("YES\n");
}








