Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
24574 | LeoWang | 字符大小写转换 | C++ | Accepted | 0 MS | 248 KB | 298 | 2023-08-14 04:51:41 |
#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; }