I made this changes in the executor map to run the program in the external termina:
"code-runner.executorMap": {
"cpp": "g++ $fullFileName -o $fileNameWithoutExt.exe && start $fileNameWithoutExt.exe"
}
The program did start to run in the external terminal but it ends after taking the input.
Here is the simple C code:
#include<stdio.h>
int main()
{
int x,y,l,a,b;
printf("Enter the bottom left co-ordinates of the square: ");
scanf(" %d %d", &x, &y);
printf("Enter the length of the square: ");
scanf(" %d", &l);
printf("Enter the co-ordinates to be checked: ");
scanf(" %d %d", &a, &b);
if((a>=x && a<=(x+l)) && (b>=y && b<=(y+l))) //boundary limits for four sides of the square
{
printf("
%d,%d lies inside the square.", a,b);
}
else
{
printf("
%d,%d don't lie inside the square.", a,b);
}
return 0;
}
The program then ends after taking the input. Please help me to solve this problem of VS Code.
question from:
https://stackoverflow.com/questions/65896528/c-program-ending-after-taking-input-in-vs-code-external-terminal 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…