P051第7题

来源:互联网 发布:哪个软件国外天气 编辑:程序博客网 时间:2024/05/22 04:40

#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
int main()
{char  x,y,ch='y';
while(ch=='y')
{
 {printf("Please input two character:\n");
  scanf("%c %c",&x,&y);
  while((ch=getchar())!='\n');
      if((x-y)%2==0)
   {  if(x>=y)
           printf("后继:%c\n",x+1);
         else
        printf("后继:%c\n",y+1);
   }
      else if(x>=y)
          printf("前趋:%c\n",y-1);
           else
          printf("前趋:%c\n",x-1);
}
  printf("是否继续:\'y\'/\'n\'");
  ch=getche();
}
if(ch=getchar()=='n')
return 0;
}

0 0
原创粉丝点击