0

How to invoke toupper and tolower function?

How can I invoke toupper and tolower function? I coded like this -> int main() { char string[100]; cin>>string ; for (int i=0;string[i]!='\0';i++) {if(isupper(string[i])!=0) {putchar tolower(string[i]);} if(islower(string[i])!=0) {putchar toupper(string[i]);} } cout<<"\n"<<string; return 0; }

16th Aug 2019, 5:00 PM
Raj Tiwari
2 Answers
+ 2
You didn't write braces when calling putchar(), which is of course a function, in both if-statements. Fixing that makes the code run: https://code.sololearn.com/czSzCvtL7fd3/?ref=app
16th Aug 2019, 5:54 PM
Shadow
Shadow - avatar
+ 2
you have to put else before second if statement to be checked at loop in my understanding
16th Aug 2019, 5:36 PM
ABADA S
ABADA S - avatar