If you use code runner in VS Code and you are having issues in running programs that take input from users there is one setting you need to change in your VS Code that will fix this problem.
Here I have written a simple program that takes an integer input from users and prints it. But when I heat run code in VS Code that code runner runs and keeps running never prompt me anything. Even If I close the output section the Code runner is running in the background.
Many people face this problem, there is a small thing to notice when we run the program it opens the output window. "OUTPUT" window, So how can we expect it to take input from users? So we need to set Code Runner to run where we can input data. There is an inbuilt terminal in VS Code and the terminal can also take input. So we need Code Runner to run inside the terminal.
Setting Up Code Runner to run in terminal
Make sure not to miss spell anything copy and paste it as it is. Here is my setting
Ignore other settings and just paste the line I gave you properly. Save it and reopen VS Code. And now let's see if it is working properly or not.
You see it's working now. We are allowed to make an input because the Code Runner is running inside the terminal.
Also read: Write a C Program to sort an array of strings in dictionary order
Post a Comment