+ 1
how to get input string ?
which type? which library?
2 Answers
+ 2
if you need a program to take an input of type string, you need to include the string library: #include<string>
then you declare a variable of type string:
string NameOfYourChoice;
and finally, get it from the standard input.:
std::cin>> NameOfYourChoice;
Now, there are other ways of accepting a string input, but this is the most basic one that should be good enough for basic programs.
0
thanks