60 578
Assignments Done
97,9%
Successfully Done
In April 2018

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 :(?
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions