+ 4

Gets not working

Why does gets in stdio.h in C++ not work in the code playground? It doesn't ask for any input from the user when in fact it should.

18th Feb 2018, 5:22 PM
The Missalaneous Era
The Missalaneous Era - avatar
5 odpowiedzi
+ 12
AFAIK, gets is obsolete and no longer supported by most modern compilers. https://stackoverflow.com/questions/7423691/is-gets-officially-deprecated
18th Feb 2018, 5:29 PM
Hatsy Rei
Hatsy Rei - avatar
+ 14
@jacob probably!
18th Feb 2018, 6:12 PM
Daljeet Singh
Daljeet Singh - avatar
+ 11
@Jacob Last time I checked, getline() works without being in need of the little trick. Nonetheless, what you said is legit for std::cin.get() on Code Playground.
18th Feb 2018, 5:35 PM
Hatsy Rei
Hatsy Rei - avatar
+ 7
Same reason why getline won’t work. Input text box is only opened if you have a certain keyword in your program that SoloLearn recognizes as input. In C++, that is “cin >>”. Add this line and it should work: #define INPUT cin >> I know that makes getline work anyway.
18th Feb 2018, 5:30 PM
Jacob Pembleton
Jacob Pembleton - avatar
+ 3
@Hatsy Rei Probably just another problem with the iOS app, I still have to put it there.
18th Feb 2018, 5:52 PM
Jacob Pembleton
Jacob Pembleton - avatar