- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int start,end,a,b;
- char a;
- re:
- cout<<"1ascii轉字母 2字母轉ascii 3結束"<<endl;;
- cin>>start;
- switch(start)
- {
- case 1:
- cout<<"請輸入ASCII碼: ";
- cin>>end;
- cout<<"字元為: "<<char(end);
- break;
- case 2:
- cout<<"請輸入字元: ";
- cin>>a;
- cout<<"ASCII為: "<<int(a);
- break;
- case 3:
- goto end;
- break;
- default:
- cout<<"輸入錯誤"<<endl;
- }
- cout<<endl;
- goto re:
- end:
-
- system("pause");
- return 0;
- }
複製代碼 |