9

While taking input from the user using C++/Java, program is running successful and Visual Studio Code does asks user to input, but when I try to enter anything like a number or a character, it takes no input.

enter image description here

3
  • is there something wrong with vs code setup as i m able to run C and it takes input from the user normally but with java/c++ it asks for input but take nothing Commented Feb 8, 2022 at 8:16
  • Why do you write a comment to your own question? If you want to add anything to the question after you posted it, just edit it. Commented Feb 8, 2022 at 8:20
  • Try to do this stackoverflow.com/a/49846389/14755898 Commented Feb 8, 2022 at 8:26

2 Answers 2

15

Your program is running in Output tab, therefore it is not possible to take input. Just enable Run in terminal in Visual Studio Code Settings.

Settings (ctrl+,) -> Search settings, look for code runner: run in terminal (check)

Note: It is supposed that you have Code Runner extension installed.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi @Abhishek Sharma if this or any answer has solved your question please consider accepting it by clicking the check-mark. This indicates to the wider community that you've found a solution and gives some reputation to both the answerer and yourself. There is no obligation to do this.
9
  1. Go to extensions (Ctrl+shift+X) and install code Runner.enter image description here
  2. Go to Settings. (File ---> Preferences --->Settings)enter image description here
  3. Search Code Runner, then checkenter image description here

code runner: run in terminal

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.