Why doesn't this work? (strings)
Found this code inside accelerated c++...as an exercise....
I don't understand why the code does not work.. the bottom code...
It gives the following error
8 c:\docume~1\pier\mydocu~1\sc103\lab4\untitl~1.cpp
invalid operands `const char[6]' and `const char[7]' to binary `operator +'
Pier.
Code:
#include <iostream>
#include <string>
int main(void) {
/*const string hello = "Hello";
const string message = hello + ", world" + "!"; */ //works
const string exclam = "!";
const string message = "Hello" + ",world" + exclam;
return 0;
}