Powershell缺少C程序的输出

时间:2017-03-08 18:54:06

标签: c powershell

我意识到之前已经回答了许多类似的问题,但我只能找到Unix系统的解决方案,并且我在Windows中使用Powershell和MinGW。

我知道我的路径设置正确,因为我的Hello World程序会提供输出,但是这个程序没有:

#include <stdio.h>

main()
{
  float fahr, celsius;
  int lower, step, upper;

  upper = 300;
  step = 20;
  fahr = lower;

  while (fahr <= upper) {
    celsius = (5.0/9.0) * (fahr - 32.0);
    printf ("%3.0f %6.1f\n", fahr, celsius);
    fahr += step;
  }

}

运行MinGW生成的可执行文件时,没有显示输出;它只是进入Powershell的下一行。我已经看到了声称需要使用ctrl-D来模拟EOF的答案,但这仅适用于Unix系统。我见过有人说ctrl-Z适用于Windows,但在这种情况下不起作用。

0 个答案:

没有答案