//Program to convert uppercase alphabet lowercase and lowercase alphabet to uppercase in a string
#include <bits/stdc++.h> using namespace std;
int main() { string s; //requesting string cin>>s; int l=s.length(); //checking length for(int i=0;i<l;i++){ //loop to go through each char in string if(s[i]>=97 && s[i]<=122){ //for lowercase to uppercase s[i]=s[i]-32; } else if(s[i]>=65 && s[i]<=90){ //for uppercase to lowercase s[i]=s[i]+32; } } cout<<"Updated String: "<<s<<endl; //printing the updated string
0 Comments