c++小写转大写函数和大写转小写函数原型

来源:互联网 发布:网络规划设计师 职称 编辑:程序博客网 时间:2024/05/19 00:17
#include "stdafx.h"#include <Windows.h>#include <iostream>using namespace std;// 小写转大写int my_toup(int ch){if (ch >= 'a' && ch <= 'z'){return ch - (int('a')-int('A')); }else{return ch;}}// 大写转小写int my_tolower(int ch){if (ch >= 'A' && ch <= 'Z'){return ch + (int('a')-int('A'));}else{return ch;}}int _tmain(int argc, _TCHAR* argv[]){char cCh[]="abc123ABC";char *pCh=cCh;while(*pCh != '\0'){cout<<(char)my_toup(*pCh)<<" , "<<(char)my_tolower(*pCh)<<endl;*pCh++;}system( "pause" );return 0;}

0 0