返回列表 發帖

字串的處理 - 將ASCII碼轉換為字串

本帖最後由 tonyh 於 2012-5-5 16:18 編輯
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int ascii_start, ascii_end;
  7.     cout<<"在此輸入ASCII碼範圍"<<endl;
  8.     cout<<"起始值: ";
  9.     cin>>ascii_start;
  10.     cout<<"終止值: ";
  11.     cin>>ascii_end;
  12.     cout<<"所得字串: ";
  13.     for(int i=ascii_start; i<=ascii_end; i++)
  14.     {
  15.         cout<<char(i);     
  16.     }
  17.     cout<<endl;
  18.     system("pause");
  19.     return 0;   
  20. }
複製代碼

返回列表