Answers for "how to run a cpp file in cmd"

C++
0

how to run cpp file

# Open Terminal: 

# Type: 
g++ --version

# If the command is not recognized: 
sudo apt-get install g++ 
g++ --version # should work now 

# If the command is recognized
mkdir tmp 
cd tmp 
touch main.cpp 
# open main.cpp using vi, vim, gedit, etc
# Type in a hello world program: 
# https://www.tutorialspoint.com/cplusplus-hello-world-program

# Once this has been done, type in: 
g++ main.cpp
./a.out
Posted by: Guest on August-31-2021
2

run cmd command c++

#include <iostream>
using namespace std;

int main() {
    system("DATE");
    return 0;
}
Posted by: Guest on January-24-2020

Browse Popular Code Answers by Language