0

What header files to use while entering a string in sololearn code playground? I used <stdio.h> but it isn't taking input.

I used gets to take input, as is done with strings.

26th Sep 2017, 11:15 PM
Divyanshu
Divyanshu - avatar
2 odpowiedzi
+ 12
// gets is obsolete, do not use it. #include <iostream> #include <string> int main() { std::string myVar; std::cin >> myVar; // input without whitespaces getline(std::cin, myVar); // input entire line }
26th Sep 2017, 11:21 PM
Hatsy Rei
Hatsy Rei - avatar
+ 1
Use #include<string.h>
26th Sep 2017, 11:28 PM
Avinash Gupta
Avinash Gupta - avatar