- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int n;
- char str[0];
- cout<<"請輸入一組英文字串: ";
- cin.getline(str,50);
- cout<<"(1) 轉為大寫 (2)轉為小寫" ;
- cin>>n;
- if(n==1)
- {
- strupr(str);
- cout<<"您輸入的英文字串已變大寫,結果如下:"<<endl;
- cout<<str<<endl;
- }
- if(n==2)
- {
- strupr(str);
- cout<<"您輸入的英文字串已變小寫,結果如下:"<<endl;
- cout<<str<<endl;
- }
- system("pause");
- return 0;
- }
複製代碼 |