函数 ------------------------说明
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]);
}