I have realised my mistake. I was trying to concatenate two strings.
I have just started to learn C++. I have a problem about string concatenation. I don't have problem when I use:
cout << "Your name is"<<name;
But when I try to do it with a string:
string nametext;
nametext = "Your name is" << name;
cout << nametext;
I got an error. How can I concatenate two strings?
For string concatenation in C++, you should use the +
operator.
nametext = "Your name is" + name;