1、输入一个ASCII码,输出对应的字符
#include <iostream>
using namespace std;
int main()
{
int n;
while (cin >> n)
{
cout << (char)n << endl;
}
return 0;
}
2、输入一个字符,输出相对应的ASCII码
#include <iostream>
using namespace std;
int main()
{
char k;
while (cin >> k)
{
cout << (int)k << endl;
}
return 0;
}
3、字符之间相加减
已知a,b为字符,
a-b即为a的ascii码减去b的ascii码,记为int k=a-b;
结果K为ascii码;
char(k)为字符;