返回列表 發帖
本帖最後由 洪藜芸 於 2020-4-11 11:58 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     char s[100];
  7.     cout<<"請輸入一字串(長度100以內): ";
  8.     cin.getline(s,100);
  9.     cout<<"此字串的ASCII字元碼依序為: "<<endl;
  10.     for(int i=0;s[i]!=NULL;i++)
  11.         cout<<s[i]<<"→"<<int(s[i])<<endl;
  12.    
  13.     system("pause");
  14.     return 0;
  15. }
複製代碼

TOP

返回列表