0
Why doesn't getchar() function work on Sololearn in C++ code?
Am I missing something? In C code it works. https://code.sololearn.com/cnKiagl94j4P/?ref=app https://code.sololearn.com/ct1cSEV2l825/?ref=app
3 odpowiedzi
0
I think it's some kind of bug. When you try:
char c = getchar();
cout << c;
cin >> c;
cout << c;
And send two separate inputs, it will work fine, so it may be just SoloLearns bug
0
A.S. The problem is that you can't input anything in the C++ code. As author mentioned - In C code it works.
- 2
Becz you not printing value that's why it showing no output use printf and cout it will work
#include <stdio.h>
int main() {
//getchar();
printf("%c",getchar());
return 0;
}