Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
17676 | lulu | 字符大小写转换 | C++ | Accepted | 0 MS | 244 KB | 298 | 2023-05-16 10:33:38 |
#include<bits/stdc++.h> using namespace std; int main() { string a; cin>>a; for(int i=0;i<a.length();i++){//A ASCII 65 if(a[i]>='a'&&a[i]<='z'){ a[i]-=32; }//不加else,会换回去 else if(a[i]>='A'&&a[i]<='Z'){//a ASCII 97 a[i]+=32; } } cout<<a; return 0; }