返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.     int n;
  7.     char str[0];
  8.     cout<<"請輸入一組英文字串: ";
  9.     cin.getline(str,50);
  10.     cout<<"(1) 轉為大寫  (2)轉為小寫" ;
  11.     cin>>n;
  12.     if(n==1)
  13.     {
  14.         strupr(str);
  15.         cout<<"您輸入的英文字串已變大寫,結果如下:"<<endl;
  16.         cout<<str<<endl;        
  17.     }
  18.     if(n==2)
  19.     {
  20.         strupr(str);
  21.         cout<<"您輸入的英文字串已變小寫,結果如下:"<<endl;
  22.         cout<<str<<endl;        
  23.     }
  24.     system("pause");
  25.     return 0;   
  26. }
複製代碼

TOP

返回列表