【发布时间】:2020-11-20 07:58:54
【问题描述】:
所以我在 Vscode 中预装了“Code Runner”和“C/C++”等扩展。
我面临的问题是在运行代码时卡住了:
#include <stdio.h>
#include <stdlib.h>
int main()
{
//program to convert minutes into years and days
int min = 0;
double yrs = 0.0;
double days = 0.0;
double min_in_yr = 0;
printf("Enter the nmuber of minutes: ");
//get input from the user
scanf("%d", &min);
//calculation
min_in_yr = (60 * 24 * 365);
yrs = (min / min_in_yr);
days = (yrs * 365);
printf("%d minutes is approx %f years and %f days\n", min, yrs, days);
return 0;
}
代码没有问题,因为它似乎在 CodeBlocks 上运行良好。
我还尝试执行一个简单的 hello world 程序,该程序似乎在 1.8 秒内在 Vscode 上完美执行。
可能是什么问题?
【问题讨论】:
-
您的代码编译并运行良好。您的配置或 Code Runner Extension 一定有问题。你有注意扩展的配置部分吗?
-
@ErdalKüçük 我不知道任何配置问题,因为我所做的一切都是来自教程。如果我让代码在 Vscode 的终端中运行,它可以工作,而在输出部分它会卡在运行中。
-
@TMK 我检查了我的系统,它工作正常。可以告诉我们错误吗?
-
@KrishnaKanthYenumula 在面板的输出部分,它卡在运行中,如果我尝试从终端执行它,它工作正常。我必须在设置中启用终端选项才能工作。是你能在控制台的输出部分运行吗?
标签: c visual-studio-code