函數 ------------------------說明
toupper(c) | c是小寫就返回大寫;否則原樣返回 |
---|---|
tolower(c) | c是大寫就返回小寫;否則原樣返回 |
頭文件
#include <cctype>
下面一個例題;
#include <iostream>
#include <cstring>
#include <cctype>
using namespace std;
void g(char *p);
int main()
{ char s[100];
cin.getline(s,100);
g(s);
cout<<s<<endl;
return 0;
}
void g(char *p)
{int len=strlen(p);//測量長度
for(int i=0;i<len;i++)
p[i]=toupper(p[i]);
}