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

20 lines
357 B
C++

#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;
}