Solutions of Uppercase and lowercase - MarisaOJ: Marisa Online Judge

Solutions of Uppercase and lowercase

Select solution language

Write solution here.


ducyn    Created at    1 likes

**Hint**: - Sử dụng hàm *islower* và *isupper* để kiểm tra xem chữ được nhập vào là chữ thường hay hoa - Sử dụng hàm *tolower* - để chuyển thành chữ thường và *toupper* - để chuyển thành chữ hoa ------- Code tham khảo: ```cpp #include <bits/stdc++.h> #define ll long long #define name "TASK" #define TIME (1.0 * clock() / CLOCKS_PER_SEC) using namespace std; void solve(){ char c; cin>>c; if(islower(c)) c=toupper(c); else if(isupper(c)) c=tolower(c); cout<<c<<'\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); if(fopen(name".INP","r")) { freopen(name ".INP","r",stdin); freopen(name ".OUT","w",stdout); } solve(); cerr << '\n' << "Time collapsed: " << TIME << '\n'; return 0; } ```