Check out example codes for "running a c++ program in visual studio code cannot edit in read only editor". It will help you in understanding the concepts better.

Code Example 1

File > Prefrences >Setting 

type : run code 

scroll until you get code-runner and check on the "Whether to run code in integrated terminal"
restart vscode

Learn ReactJs, React Native from akashmittal.com