- Use visual mode to select the code and use '<leader>pp or ,pp' to run the program in cpp.
- c++ is compiled language so we need to compile the code first and then run it. example: g++, clang, intel compiler etc.
- The job of compiler is to convert the c++ code into machine code (binary file) or executable.
- we always save first and then compile the code.
example:
#include <iostream>
int main() {
std::cout << "Hello, World!" << std::endl;
return 0;
//return EXIT_SUCCESS; // if we include <cstdlib>
// return RETURN_SUCCESS; // if we include <cstdlib
}
output:
'Hello, World!'