版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/Lichengguang_std/article/details/81559128
字符串大小写转换的一个最基本的算法就是基于ACSII表进行转换;
#include<iostream>
#include<string>
using namespace std;
int main(){
string st;
cin >> st;
int n = st.size();
for (int i = 0; i < n; i++){
if (st[i] >= 'A'&&st[i] <= 'Z'){
st[i] = st[i] + 32;
}
}
cout << st;
return 0;
}