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.
3 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
}
+ 1
Use #include<string.h>