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

22 lines
356 B
C++
Raw Permalink Normal View History

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