Visual Studio Code – how to make code appear in the terminal ? terminal show also Build finished successfully, Terminal will be reused by tasks, press any key to close it
Open New terminal from options above.
Command: g++ .practice.cpp
it will create .exe file with some name in same folder
Command: .<file_name>.exe
This will run the file
To make it easy to run program
Install "Code runner" extension: It will give to button to run program on top-right.
By default, it will give output in Output tab in panel
Make few changes, in code runner setting by checking check boxes for
1)’clear previous output’ and
2)’Run in terminal’
This will run the program in one click without needing to build and run with commands.
2
Answers
From the screenshot that you shared, to run it from a terminal:
It seems that you only built the code, that’s why it wasn’t being executed:
This command will compile
practice.cpp
into the executablepractice
.You only need to build again when the source code changed.
Open New terminal from options above.
Command: g++ .practice.cpp
it will create .exe file with some name in same folder
Command: .<file_name>.exe
This will run the file
To make it easy to run program
Install "Code runner" extension: It will give to button to run program on top-right.
By default, it will give output in Output tab in panel
Make few changes, in code runner setting by checking check boxes for
1)’clear previous output’ and
2)’Run in terminal’
This will run the program in one click without needing to build and run with commands.