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

时间:2017-07-02 16:26:06

标签: netbeans

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

//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)

代码在codeblock中运行。我刚刚复制并粘贴了

0 个答案:

没有答案