can someone plz explain to me in simple terms why the following code doesn't compile?
Code:
#include <iostream>
int main()
{
const std::string exclam = "!";
const std::string message = "hello" + ",world" + exclam;
std::cout << message;
}
and why these do?
Code:
#include <iostream>
int main()
{
const std::string exclam = "!";
const std::string message = exclam + "hello" + ",world" + exclam;
std::cout << message;
}
Code:
#include <iostream>
int main()
{
const std::string exclam = "!";
const std::string message = "hello,world" + exclam;
std::cout << message;
}