您的位置:首页 > 其它

第二章作业P51.7

2015-04-02 20:03 197 查看
#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
char ch1,ch2;
cin>>ch1>>ch2;
char ch;
do{
if((ch1-ch2)%2==0)
{
if(ch1>ch2)
cout<<(char)(ch1+1)<<endl;
else
cout<<(char)(ch2+1)<<endl;
}
else
{
if(ch1<ch2)
cout<<(char)(ch1-1)<<endl;
else
cout<<(char)(ch2-1)<<endl;
}
printf("是否继续?\[y/n]");
while((ch=getchar())!='\n');
}while((ch=getchar())=='y');

return 0;
}

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: