- #include<iostream>
- #include<cstdlib>
- using namespace std;
- int main()
- {
- char str[50]; //宣告一字串陣列
- cout<<"請輸入要轉換的英文字串(50字內): ";
- cin.getline(str,50); //抓取字串, 到第50個字元
- strlwr(str); //strlwr 為 'string lower' 的縮寫
- cout<<"轉換成小寫: "<<str<<endl;
- strupr(str); //strupr 為 'string upper' 的縮寫
- cout<<"轉換成大寫: "<<str<<endl;
- system("pause");
- return 0;
- }
複製代碼 |