如果傳入值是小寫字母,傳回大寫字母,否則傳回參數。
#include <iostream>
#include <string>
using namespace std;
//-----------------------
int main()
{
int i ;
char str[10] = "hello" ;
for(i = 0 ; i < strlen(str) ; i++ )
str[i] = toupper(str[i]) ;
cout << str << endl ;
system("pause");
return 0;
}
執行結果
全站熱搜