This repository has been archived on 2025-04-15. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
kmitl-profund-exercise/string-case-swapper-alt/main.cpp

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

2023-04-03 01:08:03 +07: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;
}