Answer to Question #56419 in C++ for raneem

Question #56419
Write a program that reads a string them changes capital letters with small letters and
small letters with capital letters?

can you please help me know the answer :(?
1
Expert's answer
2015-11-19T03:42:32-0500
#include <stdio.h>
#include <ctype.h>

int main() {
char buffer[100];
fgets(buffer,100,stdin);

for(char *c=buffer; *c!='\0'; c++) {
if(*c>='A' && *c<='Z') *c=tolower(*c);
else if(*c>='a' && *c<='z') *c=toupper(*c);
}

printf("%s",buffer);

return 0;

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS