Thread: runtime error

  1. #1
    Registered User
    Join Date
    Feb 2002
    Posts
    11

    Question runtime error

    I am using Visual c++ 6
    Every time i run this program i got a message
    runtime error.

    Can anyone tell me what's wrong in my program?
    Thank

    #include<stdio.h>

    #define SMALL_PIZAA 8.50
    #define MEDIUM_PIZZA 12.65
    #define LARGE_PIZZA 18.50

    #define SMALL_SLICE 4
    #define MEDIUM_SLICE 8
    #define LARGE_SLICE 12

    void getClassData(int *, int *, int *, int *, double *);
    void menu(void);

    /************************************************** ***************************
    * *
    * Main *
    * *
    ************************************************** ***************************/

    int main(void)
    {
    int student, totSmPizza, totMdPizza, totLgPizza;
    double money;

    menu();
    getClassData(&student, &totSmPizza, &totMdPizza, &totLgPizza, &money);

    return 0;
    }


    /************************************************** ***************************
    * *
    * Pizza Menu *
    * *
    ************************************************** ***************************/

    void menu(void)
    {
    printf("\n\n");
    printf("\t\t************************************** **************\n");
    printf("\t\t* *\n");
    printf("\t\t* Pizza Menu *\n");
    printf("\t\t* *\n");
    printf("\t\t************************************** **************\n");
    printf("\t\t* *\n");
    printf("\t\t* Size Price Slice *\n");
    printf("\t\t* **** ***** ***** *\n");
    printf("\t\t* *\n");
    printf("\t\t* Small $8.50 4 *\n");
    printf("\t\t* *\n");
    printf("\t\t* Medium $12.65 8 *\n");
    printf("\t\t* *\n");
    printf("\t\t* Large $18.50 12 *\n");
    printf("\t\t* *\n");
    printf("\t\t************************************** **************\n");
    printf("\n\n");

    return;
    }

    /************************************************** ***************************
    * *
    * Get Class Date *
    * *
    ************************************************** ***************************/

    void getClassData(int *student, int *smPizza, int *mdPizza, int *lgPizza, double *money)
    {
    printf("\t\tEnter how many students in your class: ");
    scanf("%d", student);

    printf("\n\n\t\tHow many small size pizza you want to order? ");
    scanf("%d", smPizza);

    printf("\t\tHow many medium pizza you want to order? ");
    scanf("%d", mdPizza);

    printf("\t\tHow many large pizza you want to order? ");
    scanf("%d", lgPizza);

    printf("\n\n\t\tEnter how much money you have: ");
    scanf("%lf", money);

    return;
    }




    *******************output******************


    Enter how many students in your class: 25


    How many small size pizza you want to order? 3
    How many medium pizza you want to order? 3
    How many large pizza you want to order? 3


    Enter how much money you have: 333.33

    runtime error R6002
    - floating point not loaded
    Press any key to continue

  2. #2
    Registered User C_Coder's Avatar
    Join Date
    Oct 2001
    Posts
    522
    The compiler isnt including the floating point libary as there is no floating point operations.
    Add this function to your code, you shouldn't even need to call it in your program and compile.
    Code:
    void dummy( void )
    {
         float num = 0;   // force compiler to include the libary
    }
    When it runs okay you can remove this function from your code altogether.
    All spelling mistakes, syntatical errors and stupid comments are intentional.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  2. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  3. Post...
    By maxorator in forum C++ Programming
    Replies: 12
    Last Post: 10-11-2005, 08:39 AM
  4. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  5. Stupid compiler errors
    By ChrisEacrett in forum C++ Programming
    Replies: 9
    Last Post: 11-30-2003, 05:44 PM