How do I use std::getline
to read input with a constant part and variable part..
for example:
constant part
: "I_love
"
variable part
: "cat, dog, donkey, bird.....
"
And I tried this code by writing: I_love cat
But i realized that "cat"
will not be in string Variable
, it will be with the constant part
and variable part
will not have any value
I want to have cat
in the string Variable
Please can any one tell me what is the problem??
std::string UserInput, Variable;
std::getline(std::cin,UserInput);
if (UserInput == "constant_part" + Variable)
{
.....
}
Thanks in advance.