- 1
I have a problem with a code which works on my laptop but not on sololearn
#include <iostream> using namespace std; #include <stdio.h> #include <stdlib.h> #include<ctype.h> int main() { char c; printf("ENTER TEXT !\n"); while(c=getchar()) if(isupper(c)) putchar(tolower(c)); else putchar(toupper(c)); return 0; }
2 odpowiedzi
+ 11
Although it looks messy, I think it'll do. scanf is not working in code playground.
Give your input like:
b
M
s
0
https://code.sololearn.com/cb9w5MWL6Dgn/?ref=app
+ 3
duplicate post (~30m gap)
https://www.sololearn.com/Discuss/844912/?ref=app
The implementation here is batch, not interactive. Sometimes I recommend a dummy function to signal SoloLearn's input box:
void dummy(){ char x; cin >> x; } // never called
But your code relies on reading a NULL byte to end, which (going on short tests here) isn't sent in the batched character stream / pipe.