#include <iostream>
using namespace std;
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
void transLetter(int n,char *p){
int i = 0;
while(*p!='\0'){
cout<<endl;
if(*p >= 'a'&& *p <='z'){
*p -= 32;
// (*p) &= ~0x20;
p++;
}else if(*p >= 'A'&& *p <='Z' ){
*p += 32;
// (*p) |=0x20;
p++;
}
i++;
}
}
void display(char*p){
cout<<endl;
cout<<"输出:"<<endl;
while(*p !='\0'){
cout<<*p<<"\t";
p++;
}
}
int main() {
int len = 4;
char *p = new char[len]{'a','B','c','d'};
transLetter(len,p);
display(p);
return 0;
}
复试4.1大小写字母转换
最新推荐文章于 2023-02-16 09:38:18 发布