Visual Studio Code: Take Input From User

Solution 1:

Go to Code -> Preferences -> Settings and add custom settings:

{
   "code-runner.runInTerminal": true
}

Finally run your c++ code and you will be able to enter values in console

Solution 2:

Go to settings (ctrl+,) -> Search settings -> : Code-runner : Run in terminal - Check this and you will be able to run the code directly in the terminal which takes input. :)

Solution 3:

Make sure you have code runner installed on your VS code.

From top select: File > Preferences > Settings

Search for code runner in settings and check the box:

code runner settings

By default it remains unchecked. You have to enable it to run your preferred languages in terminal.