ch+1 //将ch转换成int(ASCII)然后和1相加后输出(隐式类型转换,因为1是int型)
++ch //输出下一个对应的字符(输入A,就输出B)
ch++ //代表字符先输出,后加1
#include <iostream>
int main()
{
using namespace std;
char ch;
cout<<"Type, and I shall repeat.\n";
cin.get(ch);
while (ch!='.')
{
if (ch=='\n')
{
cout<<ch;
}
else
{
cout<<++ch; //++ch显示下一个对应的字符
cout<<ch+1; //将ch转换成int(ASCII)然后和1相加后输出(隐式类型转换,因为1是int型)
cout<<ch++; //ch++代表字符先输出,后加1
}
cin.get(ch);
}
system("pause");
cin.get();
cin.get();
return 0;
}