- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- int x;
- char string[50];
- cout<<"請輸入要轉換的英文字串(50字內): ";
- cin.getline(string,50);
- cout<<"請問是要轉換成大寫還是小寫??1.大寫 2.小寫"<<endl;
- cin>>x;
- if(x==1)
- {
- strupr(string);
- cout<<"轉換成大寫: "<<string<<endl;
- goto end;
- }else
- {
- goto small;
- }
- small:
- strlwr(string);
- cout<<"轉換成小寫: "<<string<<endl;
- end:
- system("pause");
- return 0;
- }
複製代碼 |