#include <stdio.h>
#include <conio.h>
int main()
{
char a,b;
while(1)
{
printf("请输入两个字符\n");
a=getche();
printf("\n");
b=getche();
printf("\n");
if(a<b)
{
if((a-b)%2==0)
printf("后继字符是%c\n",b+1);
else
printf("前驱字符是%c\n",a-1);
}
else if(a>b)
{
if((a-b)%2==0)
printf("后继字符是%c\n",a+1);
else
printf("前驱字符是%c\n",b-1);
}
}while(getchar()==!'\n');
return 0;
}
#include <conio.h>
int main()
{
char a,b;
while(1)
{
printf("请输入两个字符\n");
a=getche();
printf("\n");
b=getche();
printf("\n");
if(a<b)
{
if((a-b)%2==0)
printf("后继字符是%c\n",b+1);
else
printf("前驱字符是%c\n",a-1);
}
else if(a>b)
{
if((a-b)%2==0)
printf("后继字符是%c\n",a+1);
else
printf("前驱字符是%c\n",b-1);
}
}while(getchar()==!'\n');
return 0;
}