#include <iostream> // 大写转小写 小写转大写 static char UpperOrLower(char ch) { return (ch ^ 0x20); } // 转大写 static char ToUpper(char ch) { return (ch & (~0x20)); } // 转小写 static char ToLower(char ch) { return (ch | 0x20); } int main() { char chUpper = 'P'; char chLower = ToLower(chUpper); std::cout << chLower << std::endl; chLower = 'm'; chUpper = ToUpper(chLower); std::cout << chUpper << std::endl; return 0; }
标签:ch,return,运算,0x20,c++,char,大小写,小写,static From: https://www.cnblogs.com/seeone/p/17008899.html