Netbeans中的C程序编译正确,但不会运行

Netbeans中的C程序编译正确,但不会运行,netbeans,Netbeans,我用Netbeans编写了以下C程序。它编译正确,但不会运行。当我将代码复制到代码块中时,它工作得非常好 //Demonstrates variables and constants #include <stdio.h> // Define a constant to convert a number of laps to miles #define LAPS_PER_MILE 4 //Define a constant for the current year const in

我用Netbeans编写了以下C程序。它编译正确,但不会运行。当我将代码复制到代码块中时,它工作得非常好

//Demonstrates variables and constants
#include <stdio.h>

// Define a constant to convert a number of laps to miles
#define LAPS_PER_MILE 4

//Define a constant for the current year
const int CURRENT_YEAR = 2017;

//Declare the needed variables
float miles_covered;
int laps_run, year_of_birth, current_age;

int main (void)
{
   // Input data from user
    printf("How many laps did you run: ");
    scanf("%d", &laps_run);
    printf("Enter your year of birth: ");
    scanf("%d", &year_of_birth);

    // Perform Conversion

    miles_covered = (float) laps_run/LAPS_PER_MILE;
    current_age = CURRENT_YEAR - year_of_birth;

    //Display results on screen

    printf("\nYou ran %.2f miles.", miles_covered);
    printf("\nNot bad for someone turning %d this year!\n", current_age);

}

Compile message:

cd 'C:\Users\User\OneDrive\Computer Science\Projects\Netbeans\Laps_to_miles'
C:\MinGW\msys\1.0\bin\make.exe -f Makefile CONF=Debug
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/User/OneDrive/Computer Science/Projects/Netbeans/Laps_to_miles'
"/C/MinGW/msys/1.0/bin/make.exe"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/laps_to_miles.exe
make.exe[2]: Entering directory `/c/Users/User/OneDrive/Computer Science/Projects/Netbeans/Laps_to_miles'
make.exe[2]: `dist/Debug/MinGW-Windows/laps_to_miles.exe' is up to date.
make.exe[2]: Leaving directory `/c/Users/User/OneDrive/Computer Science/Projects/Netbeans/Laps_to_miles'
make.exe[1]: Leaving directory `/c/Users/User/OneDrive/Computer Science/Projects/Netbeans/Laps_to_miles'

BUILD SUCCESSFUL (total time: 2s)
//演示变量和常量
#包括
//定义一个常数以将圈数转换为英里
#定义每英里的圈数4
//定义当前年度的常量
当前年度的施工成本=2017年;
//声明所需的变量
漂浮在水面上;
int圈数、出生年份、当前年龄;
内部主(空)
{
//从用户输入数据
printf(“你跑了多少圈:”);
scanf(“%d”圈和跑圈);
printf(“输入您的出生年份:”);
scanf(“%d”和出生年份);
//执行转换
覆盖英里数=(浮动)圈数/每英里圈数;
当前年龄=当前年份-出生年份;
//在屏幕上显示结果
printf(“\n您跑了%.2f英里”,涵盖英里数);
printf(“\n对于今年年满%d的人来说并不坏!\n”,当前年龄);
}
编译消息:
cd'C:\Users\User\OneDrive\Computer Science\Projects\Netbeans\Laps\u to\u miles'
C:\MinGW\msys\1.0\bin\make.exe-f Makefile CONF=Debug
“/C/MinGW/msys/1.0/bin/make.exe”-f nbproject/Makefile-Debug.mk QMAKE=子项目=.build conf
make.exe[1]:输入目录“/c/Users/User/OneDrive/Computer Science/Projects/Netbeans/Laps\u to\u miles”
“/C/MinGW/msys/1.0/bin/make.exe”-f nbproject/Makefile-Debug.mk dist/Debug/MinGW Windows/laps_to_miles.exe
make.exe[2]:输入目录“/c/Users/User/OneDrive/Computer Science/Projects/Netbeans/Laps\u to\u miles”
make.exe[2]:`dist/Debug/MinGW Windows/laps_to_miles.exe'是最新的。
make.exe[2]:离开目录“/c/Users/User/OneDrive/Computer Science/Projects/Netbeans/Laps\u to\u miles”
make.exe[1]:离开目录“/c/Users/User/OneDrive/Computer Science/Projects/Netbeans/Laps\u to\u miles”
构建成功(总时间:2秒)

代码在代码块中工作。我刚刚复制并粘贴了

请花时间阅读一个问题并提供一个答案。这不仅有助于人们关注你的问题,也有助于你找出问题的根源。问题来自我的scanf声明。当我注释掉两条scanf语句时,代码在netbeans中正常运行。但不知道为什么你的问题是a,还记得标记语言C