复习了一下输入输出、for和switch,做了一个ASCII码转换的小东西。
#include <iostream>
#include <string>
using namespace std;
void numtoalfa(void);
void alfatonum(void);
void showthem(void);
const int STARTOFASCII = 33;
const int ENDOFASCII = 126;
int main()
{
int k;
cout << "ASCII码转换:" << endl;
cout << "1:字符找码" << endl;
cout << "2:码找字符" << endl;
cout << "3:显示全部" << endl;
cout << "0:退出程序" << endl;
cout << "输入数字选择对应功能:" << endl;
cin >> k;
while (k != 0)
{
switch (k)
{
case 1:alfatonum(); break;
case 2:numtoalfa(); break;
case 3:showthem(); break;
default:cout << "输入有误!" << endl<<endl;
}
cout << "ASCII码转换:" << endl;
cout << "1:字符找码" << endl;
cout <