I can't run C++ code

First install the compilers if you already have not.

sudo apt install build-essential

Compile the program with g++ /path/to/filename.cpp -o /path/to/output (note that gcc may not work with programs written in C++. You would need g++).

Then run the program with /path/to/output.


Your code worked for me. I saved your code in the file new.cpp, and compiled it to an executable named output.

[archisman@home-pc ~]$ g++ new.cpp -o output
[archisman@home-pc ~]$ ./output 
C++