mortennobel / cpp-cheatsheet

Modern C++ Cheatsheet

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Operator missing?

justf0rfun opened this issue · comments

I am just refreshing my c++ syntax knowledge has been unused for years. Isn't there an operator like '+' missing in the literals section at line

"hello" "world" // Concatenated strings

Shouldn't it be?

"hello" + "world" // Concatenated strings

Try this anywhere e.g. in a cout statement:
cout<< "abcd" "efgh"<<endl;

Output:
abcdefgh

@justf0rfun @smnasirhussain
Using Sting header file you can Concatenate the two string variables. as shown below (mentioned at section string-Variable sized character array in the cheat sheet).

#include // Include string (std namespace)
string a="Hello";
string b=" World";
cout << a+b;

Output:
Hello World

@mortennobel Please close this issue.