Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
58262 | 王一涵(吃土豆长大的马铃薯) | 字符大小写转换 | C++ | Accepted | 1 MS | 244 KB | 298 | 2024-12-05 21:15:32 |
#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; }