kmitl-profund-exercise/string-case-swapper/main.cpp

21 lines
357 B
C++
Raw Normal View History

2023-04-02 18:08:03 +00:00
#include<iostream>
int main() {
char i[50];
int j=0;
printf("Input: ");
scanf("%s", i);
while(i[j]!='\0'){
if(i[j]>=97&&i[j]<=122){
i[j]=i[j]-32;
}
else if(i[j]>=65&&i[j]<=90){
i[j]=i[j]+32;
}
j++;
}
printf("Output: ");
printf("%s\n", i);
return 0;
}