What is the problem?

I saw this example in one of the books:

const string exclam = "!";
const string message = "Hello" + "world" + exclam;

There were asked to try to determine the work programme or not, but there was no more comments. I understand that the problem with the quotation mark before "the world", but what is the essence of the problem is unclear.
June 14th 19 at 20:31
1 answer
June 14th 19 at 20:33
Try to compile and see what the problem is, "hi" is not a string, but const char[]. That worked, you can for example do this:
const string message = std::string("Hello") + ", world" + exclam;

Now the hi - std::string for which an overloaded operator +
Or use User Defined Literals and "Hello"s + ", world"s + exclam; - Tyreek_Kuhn94 commented on June 14th 19 at 20:36

Find more questions by tags C++