How to run C++ program in cmd?

verify gcc installtion using the command:
        $ gcc -v
then go to your working directory or folder where your code is:
        $ cd <folder_name>
then build the file containing your c code as such:
        $ gcc main.cpp
        $ g++ -o main main.cpp 
then run the executable generated in your system:
        $ main.exe

Leave a Comment