大佬们帮我看看,这哪出问题了

#include<stdio.h>
#include<string.h>
const char a[26]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};
const char b[26]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; 
int main()
{
	int i,j,t;
     char c[105];
	 gets(c);
	 for(i=0;i<strlen(c);i++)
	 {
	 	for(j=0;j<=26;j++)
	 	{
	 		 if((c[i]==a[j]||c[i]==b[j])&&(j<2))
			 {
			    if(c[i]==a[j])
				 c[i]=a[j+24];
			    else
			     c[i]=a[j+24];
			 }
	 		else if((c[i]==a[j]||c[i]==b[j])&&j>=2)
	 		 {
	 			if(c[i]==a[j])
	 			c[i]=a[j-2];
	 			else
	 			c[i]=b[j-2];
			 }	
		 }
	  }	
	  for(i=0;i<strlen(c);i++)
	  printf("%c",c[i]);
	  return 0;
} 

输入ab 的正常输出情况是yz,可这为啥是wx啊?

查看全部
m0_51111980
繁花fancy
2020/11/27 21:08
  • c语言
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复