X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Recipient: djgpp AT delorie DOT com Date: Tue, 18 Sep 2007 10:43:55 -0400 From: Ethan Rosenberg Subject: C programming errors To: DJGPP List Message-id: <0JOK00CBNJLO0VL0@mta3.srv.hcvlny.cv.net> MIME-version: 1.0 X-Mailer: QUALCOMM Windows Eudora Version 7.1.0.9 Content-type: multipart/alternative; boundary="Boundary_(ID_x2432Oakb0QQ2yMqK5vhqA)" Reply-To: djgpp AT delorie DOT com --Boundary_(ID_x2432Oakb0QQ2yMqK5vhqA) Content-type: text/plain; charset=us-ascii; format=flowed Content-transfer-encoding: 7BIT Dear List - Can someone please help me with the following C code. It aborts with code 1. My apologies for the length of the code. Ethan ============= /* * A routine to calculate the BMI. Will perform the calculation with metric or * English input. Calculates the BMI both pregravid and gravid. */ #include #include #include #define BOLD "\x1B[1m" #define NORMAL "\x1B[0M" void enter_header(int *p_xbmig, int *p_xbmipg, int *p_xpoundsg, int *p_xpoundspg, int *p_xfeet, int *p_xinches, int *p_elec_spac, int *p_amp_gain, int y1stline, int y2ndline, int y3rdline); void display_results(int inches_display, float pounds_pg, float amp_gain, float pounds_g, int feet_display, int ibmi_pg, int ibmi_g, float elec_spac, int xbmig, int xbmipg, int xpoundsg, int xpoundspg, int xfeet, int xinches, int xelec_spac, int xamp_gain, int y1stline, int y2ndline, int y3rdline); static int ibmi_pg, ibmi_g; static float meters, inches, pounds, pounds_pg, pounds_g, kg, feet, bmi, bmi_pg; static float bmi_g, elec_spac, amp_gain; int xamp_gain; /* * The calculating function. Takes input in meters/kg or feet-inches/pounds, converts * from metric to english, and performs the calculation. */ int main(void) { int x, y, key, ibmi, valid, not_correct, not_valid; int iter; char choice, choice2; int xbmig, xbmipg, xpoundsg, xpoundspg, xfeet, xinches, xelec_spac; int /*xamp_gain,*/ ifeet_display, inches_display, feet_display; int y1stline, y2ndline, y3rdline, spacing, gain; int *p_xbmig, *p_xbmipg, *p_xpoundsg, *p_xpoundspg, *p_xfeet, *p_xinches; int *p_xelec_spac, *p_xamp_gain, *p_y1stline, *p_y2ndline, *p_y3rdline; /*Initialize pointers*/ p_xbmig = &xbmig; p_xbmipg = &xbmipg; p_xpoundsg = &xpoundsg; p_xpoundspg = &xpoundspg; p_xfeet = &xfeet; p_xinches = &xinches; p_xelec_spac = &xelec_spac; p_xamp_gain = &xamp_gain; /* p_y1stline = &y1stline; p_y2ndline = &y2ndline; p_y3rdline = &y3rdline;*/ inches = 0.0; meters = 0.0; kg = 0.0; pounds_pg = 0.0; pounds_g = 0.0; feet = 0.0; bmi_pg = 0.0; bmi_g = 0.0; elec_spac = 0.0; amp_gain = 0.0; inches_display = 0; feet_display = 0; ibmi_pg = 0; ibmi_g = 0; y1stline = 6; y2ndline = 8; y3rdline = 10; /* Set up Header*/ enter_header(p_xbmig, p_xbmipg, p_xpoundsg, p_xpoundspg, p_xfeet, p_xinches, p_xelec_spac, p_xamp_gain, y1stline, y2ndline, y3rdline); /* Enter Height */ gotoxy(1,18); not_correct = 1; while(not_correct) { printf("\nEnter M for metric or E for English: "); y = wherey(); choice = getche(); choice = toupper(choice); if (choice == 'M' || choice == 'E') not_correct = 0; else { printf("\a"); printf("\nERROR -- Valid answers are M or E -- Press any key to continue..."); key = getch(); gotoxy(1,y-1); } } switch(choice) { case 'M': not_valid = 1; while(not_valid) { gotoxy(1,18); y = wherey(); printf("\nEnter height in meters: "); clreol(); valid = scanf("%f", &meters); while (getchar() != '\n') continue; if(valid) not_valid = 0; if(!valid) { printf("\a"); printf("ERROR -- NUMERIC ENTRIES ONLY!! -- Press any key to continue..."); key = getch(); } } clreol(); inches = meters*39.37; feet_display = (int)inches/12; inches_display = (int)inches%12; display_results(inches_display, pounds_pg, pounds_g, feet_display, ibmi_pg, ibmi_g, amp_gain, elec_spac, xbmig, xbmipg, xpoundsg, xpoundspg, xfeet, xinches, xelec_spac, xamp_gain, y1stline, y2ndline, y3rdline); break; case 'E': not_valid = 1; while(not_valid) { gotoxy(1,18); y = wherey(); printf("\nEnter height in feet & inches - FEET: "); clreol(); valid = scanf("%f", &feet); while (getchar() != '\n') continue; if(valid) not_valid = 0; if(!valid) { printf("\a"); printf("ERROR -- NUMERIC ENTRIES ONLY!! -- Press any key to continue..."); key = getch(); } } gotoxy(1, y+2); clreol(); not_valid = 1; while(not_valid) { gotoxy(1,18); y = wherey(); gotoxy(1, y+2); clreol(); printf("Enter height in feet & inches - INCHES: "); clreol(); valid = scanf("%f", &inches); while (getchar() != '\n') continue; if(valid) not_valid = 0; if(!valid) { printf("\a"); printf("ERROR -- NUMERIC ENTRIES ONLY!! -- Press any key to continue..."); key = getch(); } } gotoxy(1, y+3); printf("\n#1"); clreol(); printf("\n#2"); inches_display = (int)inches; printf("\n#3"); inches = feet*12.0 + inches; printf("\n#4"); feet_display = (int)feet; printf("\n#5"); display_results(inches_display, pounds_pg, pounds_g, feet_display, ibmi_pg, ibmi_g, amp_gain, elec_spac, xbmig, xbmipg, xpoundsg, xpoundspg, xfeet, xinches, xelec_spac, xamp_gain, y1stline, y2ndline, y3rdline); } /*End Case */ /* * Enter weights, pregavid and gravid and calculate BMI * Iterate twice, and use switch on iteration to determine if the weight * gravid or pregravid for BMI gravid and pregravid */ for(iter = 1; iter < 3; iter++) { not_correct = 1; while(not_correct) { gotoxy(1,18); clreol(); y = wherey(); printf("\nEnter M for metric or E for English: "); choice2 = getche(); choice2 = toupper(choice2); if (choice2 == 'M' || choice2 == 'E') not_correct = 0; else { printf("\a"); printf("\nERROR -- Valid answers are M or E -- Press any key to continue..."); key = getch(); gotoxy(1,y-1); } switch(choice2) { case 'M': gotoxy(1,18); clreol(); y = wherey(); gotoxy(1, y+1); clreol(); gotoxy(1,18); not_valid = 1; while(not_valid) { gotoxy(1, y+1); if(iter == 1) printf("Enter PreGravid weight in Kg: "); else printf("Enter Gravid weight in Kg: "); clreol(); valid = scanf("%f", &kg); while (getchar() != '\n') continue; if (valid) not_valid = 0; if(!valid) { printf("\a"); printf("ERROR -- NUMERIC ENTRIES ONLY!! -- Press any key to continue..."); key = getch(); } } gotoxy(1, y+2); clreol(); pounds = kg*2.204; if(iter == 1) pounds_pg = pounds; else pounds_g = pounds; display_results(inches_display, pounds_pg, pounds_g, feet_display, ibmi_pg, ibmi_g, amp_gain, elec_spac, xbmig, xbmipg, xpoundsg, xpoundspg, xfeet, xinches, xelec_spac, xamp_gain, y1stline, y2ndline, y3rdline); break; /* End Case M */ case 'E': not_valid = 1; while(not_valid) { gotoxy(1,18); y = wherey(); clreol(); gotoxy(1, y+1); clreol(); gotoxy(1,y+2); clreol(); gotoxy(1,18); if(iter == 1) printf("Enter PreGravid weight in Pounds: "); else printf("Enter Gravid weight in Pounds: "); clreol(); valid = scanf("%f", £s); while (getchar() != '\n') continue; if (valid) not_valid = 0; if(!valid) { printf("\a"); printf("ERROR -- NUMERIC ENTRIES ONLY!! -- Press any key to continue..."); key = getch(); } gotoxy(1, y+2); if(iter == 1) pounds_pg = pounds; else pounds_g = pounds; clreol(); printf("\n%s","#2"); display_results(inches_display, pounds_pg, pounds_g, feet_display, ibmi_pg, ibmi_g, amp_gain, elec_spac, xbmig, xbmipg, xpoundsg, xpoundspg, xfeet, xinches, xelec_spac, xamp_gain, y1stline, y2ndline, y3rdline); } break; } if(iter == 1) { bmi_pg = pounds_pg*703.07/(inches*inches); ibmi_pg = (int)bmi_pg; if(bmi_pg - ibmi_pg > 0.5) ibmi_pg = ibmi_pg +1; } else { bmi_g = pounds_g*703.07/(inches*inches); ibmi_g = (int)bmi_g; if(bmi_g - ibmi_g > 0.5) ibmi_g = ibmi_g +1; } display_results(inches_display, pounds_pg, pounds_g, feet_display, ibmi_pg, ibmi_g, amp_gain, elec_spac, xbmig, xbmipg, xpoundsg, xpoundspg, xfeet, xinches, xelec_spac, xamp_gain, y1stline, y2ndline, y3rdline); } iter++; } /* End Iteration */ } /* * Enter Header - a routine that writes the header for all the values and * and sets up the positions for all the variables */ /*void enter_header(int *p_xbmig, int *p_xbmipg, int *p_xpoundsg, int *p_xpoundspg, int *p_xfeet, int *p_xinches, int *p_xelec_spac, int *p_xamp_gain,int *p_y1stline, int *p_y2ndline, int *p_y3rdline)*/ void enter_header(int *p_xbmig, int *p_xbmipg, int *p_xpoundsg, int *p_xpoundspg, int *p_xfeet, int *p_xinches, int *p_xelec_spac, int *p_xamp_gain, int y1stline, int y2ndline, int y3rdline) { char dummy[] = "****************************************"; /* int y1stline, y2ndline, y3rdline;*/ clrscr(); /* gotoxy(38,3); printf("BMI");*/ /* *p_y1stline = 7; *p_y2ndline = 9; *p_y3rdline = 11; y1stline = *p_y1stline; y2ndline = *p_y2ndline; y3rdline = *p_y3rdline;*/ gotoxy(1,y1stline); printf("Hgt (ft): "); *p_xfeet = wherex(); gotoxy(15,y1stline); printf("Hgt (in): "); *p_xinches = wherex(); gotoxy(35,y1stline); printf("Wgt pg (lbs): "); *p_xpoundspg = wherex(); gotoxy(55,y1stline); printf("Wgt gvd (lbs): "); *p_xpoundsg = wherex(); gotoxy(1,y2ndline); printf("BMI pg: "); *p_xbmipg = wherex(); gotoxy(40, y2ndline); printf("BMI gvd: "); *p_xbmig = wherex(); gotoxy(1, y3rdline); printf("Elec Spac (cm): "); *p_xelec_spac = wherex(); gotoxy(40, y3rdline); printf("Amp Gain: "); *p_xamp_gain = wherex(); gotoxy(20, y3rdline + 2); printf("%s\n\n", dummy); } /* * Display Results - a routine to enter the results into the header created * with Enter Header */ void display_results(int inches_display, float pounds_pg, float amp_gain, float pounds_g, int feet_display, int ibmi_pg, int ibmi_g, float elec_spac, int xbmig, int xbmipg, int xpoundsg, int xpoundspg, int xfeet, int xinches, int xelec_spac, int xamp_gain, int y1stline, int y2ndline, int y3rdline) { gotoxy(xfeet,y1stline); printf("%d", feet_display); gotoxy(xinches,y1stline); printf("%d", inches_display); gotoxy(xpoundspg,y1stline); printf("%d", (int)pounds_pg); gotoxy(xpoundsg,y1stline); printf("%d", (int)pounds_g); gotoxy(xbmipg,y2ndline); printf("%d", ibmi_pg); gotoxy(xbmig,y2ndline); printf("%d", ibmi_g); gotoxy(xelec_spac,y3rdline); printf("%d", (int)elec_spac); gotoxy(xamp_gain,y3rdline); printf("%d", (int)amp_gain); } fspacing = (float)spacing; fgain = fspacing/3.0 + 2.0; gain = (int)fgain; if(fgain - gain > 0.5) gain = gain +1; return gain; } ====== --Boundary_(ID_x2432Oakb0QQ2yMqK5vhqA) Content-type: text/html; charset=us-ascii Content-transfer-encoding: 7BIT Dear List -

Can someone please help me with the following C code.  It aborts with code 1.  My apologies for the length of the code.

Ethan

=============
/*
 * A routine to calculate the BMI.  Will perform the calculation with metric or
 * English input.  Calculates the BMI both pregravid and gravid. 
 */

#include <stdio.h>
#include <conio.h>
#include <ctype.h>

#define BOLD   "\x1B[1m"
#define NORMAL "\x1B[0M"

void enter_header(int *p_xbmig, int *p_xbmipg, int *p_xpoundsg,
    int *p_xpoundspg, int *p_xfeet, int *p_xinches, int *p_elec_spac, int *p_amp_gain,
    int y1stline, int y2ndline, int y3rdline);


void  display_results(int inches_display, float pounds_pg, float amp_gain,
      float pounds_g, int feet_display, int ibmi_pg, int ibmi_g, float elec_spac,
      int xbmig, int xbmipg, int xpoundsg, int xpoundspg, int xfeet, int xinches,
      int xelec_spac, int xamp_gain, int y1stline, int y2ndline, int y3rdline);


static int ibmi_pg, ibmi_g;
static float meters, inches, pounds, pounds_pg, pounds_g, kg, feet, bmi, bmi_pg;
static float bmi_g, elec_spac, amp_gain;
int xamp_gain;




/*
 * The calculating function.  Takes input in meters/kg or feet-inches/pounds, converts
 * from metric to english, and performs the calculation.
 */
 
int main(void)
{
    int x, y, key, ibmi, valid, not_correct, not_valid;
    int iter;
    char choice, choice2;
    int xbmig, xbmipg, xpoundsg, xpoundspg, xfeet, xinches, xelec_spac;
    int /*xamp_gain,*/ ifeet_display, inches_display, feet_display;
    int y1stline, y2ndline, y3rdline, spacing, gain;
    int *p_xbmig, *p_xbmipg, *p_xpoundsg, *p_xpoundspg, *p_xfeet, *p_xinches;
    int *p_xelec_spac, *p_xamp_gain, *p_y1stline, *p_y2ndline, *p_y3rdline;


/*Initialize pointers*/

    p_xbmig      = &xbmig;
    p_xbmipg     = &xbmipg;
    p_xpoundsg   = &xpoundsg;
    p_xpoundspg  = &xpoundspg;
    p_xfeet      = &xfeet;
    p_xinches    = &xinches;
    p_xelec_spac = &xelec_spac;
    p_xamp_gain  = &xamp_gain;
/*    p_y1stline   = &y1stline;
    p_y2ndline   = &y2ndline;
    p_y3rdline   = &y3rdline;*/
   
    inches    = 0.0;
    meters    = 0.0;
    kg        = 0.0;
    pounds_pg = 0.0;
    pounds_g  = 0.0;
    feet      = 0.0;
    bmi_pg    = 0.0;             
    bmi_g     = 0.0;
    elec_spac = 0.0;
    amp_gain  = 0.0;
    inches_display = 0;
    feet_display   = 0;
    ibmi_pg        = 0;
    ibmi_g         = 0;
    y1stline   =  6;
    y2ndline   =  8;
    y3rdline   =  10;
   

/* Set up Header*/

    enter_header(p_xbmig, p_xbmipg, p_xpoundsg, p_xpoundspg,
          p_xfeet, p_xinches, p_xelec_spac, p_xamp_gain, y1stline,
          y2ndline,  y3rdline);


/* Enter Height */

    gotoxy(1,18);
    not_correct = 1;
    while(not_correct)
    {
        printf("\nEnter M for metric or E for English:  ");
        y = wherey();
        choice = getche();
        choice = toupper(choice);
        if (choice == 'M' || choice  == 'E')
            not_correct = 0;
        else
        {
                 printf("\a");
                 printf("\nERROR -- Valid answers are M or E -- Press any key to continue...");
                key = getch();
                 gotoxy(1,y-1);
        }

    }

    switch(choice)
    {
    case 'M':
        not_valid = 1;
        while(not_valid)
        {
            gotoxy(1,18);
            y = wherey();
            printf("\nEnter height in meters:  ");
            clreol();
            valid =  scanf("%f", &meters);
            while (getchar() != '\n')
                continue;
            if(valid)
                not_valid = 0;
            if(!valid)
            {
                printf("\a");
                printf("ERROR -- NUMERIC ENTRIES ONLY!! -- Press any key to continue...");
                key = getch();
            }
        }

        clreol();
        inches = meters*39.37;
        feet_display = (int)inches/12;
        inches_display = (int)inches%12;

        display_results(inches_display, pounds_pg, pounds_g, feet_display, ibmi_pg, ibmi_g, amp_gain,
            elec_spac, xbmig, xbmipg, xpoundsg, xpoundspg, xfeet, xinches,
            xelec_spac, xamp_gain, y1stline, y2ndline, y3rdline);

        break;

    case 'E':
        not_valid = 1;
        while(not_valid)
        {
            gotoxy(1,18);
            y = wherey();
            printf("\nEnter height in feet & inches - FEET: ");
            clreol();
            valid =  scanf("%f", &feet);
            while (getchar() != '\n')
                continue;
            if(valid)
                not_valid = 0;
            if(!valid)
            {
                printf("\a");
                printf("ERROR -- NUMERIC ENTRIES ONLY!! -- Press any key to continue...");
                key = getch();
            }
        }

        gotoxy(1, y+2);
        clreol();

        not_valid = 1;
        while(not_valid)
        {
            gotoxy(1,18);
            y = wherey();
            gotoxy(1, y+2);
            clreol();
            printf("Enter height in feet & inches - INCHES: ");
            clreol();
            valid =  scanf("%f", &inches);
            while (getchar() != '\n')
                continue;
            if(valid)
                not_valid = 0;
            if(!valid)
            {
                printf("\a");
                printf("ERROR -- NUMERIC ENTRIES ONLY!! -- Press any key to continue...");
                key = getch();
            }
        }
        gotoxy(1, y+3);
        printf("\n#1");
        clreol();
        printf("\n#2");
        inches_display = (int)inches;
        printf("\n#3");
        inches = feet*12.0 + inches;
        printf("\n#4");
        feet_display = (int)feet;
        printf("\n#5");

        display_results(inches_display, pounds_pg, pounds_g, feet_display, ibmi_pg, ibmi_g, amp_gain,
            elec_spac, xbmig, xbmipg, xpoundsg, xpoundspg, xfeet, xinches,
            xelec_spac, xamp_gain, y1stline, y2ndline, y3rdline);
    } /*End Case */

/*
 * Enter weights, pregavid and gravid and calculate BMI
 * Iterate twice, and use switch on iteration to determine if the weight
 * gravid or pregravid for BMI gravid and pregravid
 */

    for(iter = 1; iter < 3; iter++)
    {
        not_correct = 1;
        while(not_correct)
        {
            gotoxy(1,18);
            clreol();
            y = wherey();
            printf("\nEnter M for metric or E for English:  ");
            choice2 = getche();
            choice2 = toupper(choice2);
            if (choice2 == 'M' || choice2 == 'E')
                not_correct = 0;
            else
            {
                printf("\a");
                printf("\nERROR -- Valid answers are M or E -- Press any key to continue...");
                key = getch();
                gotoxy(1,y-1);
            }

            switch(choice2)
            {
            case 'M':
            gotoxy(1,18);
            clreol();
            y = wherey();
            gotoxy(1, y+1);
            clreol();
            gotoxy(1,18);
            not_valid = 1;
            while(not_valid)
            {
                gotoxy(1, y+1);
                if(iter == 1)
                    printf("Enter PreGravid weight in Kg:  ");
                else
                    printf("Enter Gravid weight in Kg:  ");
                clreol();
                valid = scanf("%f", &kg);
                while (getchar() != '\n')
                    continue;
                if (valid)
                        not_valid = 0;
                    if(!valid)
                    {
                        printf("\a");
                        printf("ERROR -- NUMERIC ENTRIES ONLY!! -- Press any key to continue...");
                        key = getch();
                    }
            }
                gotoxy(1, y+2);
                clreol();
                pounds = kg*2.204;
                if(iter == 1)
                    pounds_pg = pounds;
                else
                    pounds_g  = pounds;
       
       
                display_results(inches_display, pounds_pg, pounds_g, feet_display, ibmi_pg, ibmi_g, amp_gain,
                    elec_spac, xbmig, xbmipg, xpoundsg, xpoundspg, xfeet, xinches,
                    xelec_spac, xamp_gain, y1stline, y2ndline, y3rdline);

        break; /* End Case M */
                case 'E':
                not_valid = 1;
                while(not_valid)
                {
                    gotoxy(1,18);
                    y = wherey();
                    clreol();
                    gotoxy(1, y+1);
                    clreol();
                    gotoxy(1,y+2);
                    clreol();
                    gotoxy(1,18);
                    if(iter == 1)
                        printf("Enter PreGravid weight in Pounds:  ");
                    else
                        printf("Enter Gravid weight in Pounds:  ");
                    clreol();
                    valid =  scanf("%f", &pounds);
                    while (getchar() != '\n')
                        continue;
                    if (valid)
                       not_valid = 0;
                    if(!valid)
                    {
                        printf("\a");
                        printf("ERROR -- NUMERIC ENTRIES ONLY!! -- Press any key to continue...");
                        key = getch();
                    }
                    gotoxy(1, y+2);
                if(iter == 1)
                    pounds_pg = pounds;
                else
                    pounds_g  = pounds;

                clreol();
                printf("\n%s","#2");
               
                display_results(inches_display, pounds_pg, pounds_g, feet_display, ibmi_pg, ibmi_g, amp_gain,
                    elec_spac, xbmig, xbmipg, xpoundsg, xpoundspg, xfeet, xinches,
                    xelec_spac, xamp_gain, y1stline, y2ndline, y3rdline);

           }

        break;
        }
                if(iter == 1)
                {
                    bmi_pg = pounds_pg*703.07/(inches*inches);
                    ibmi_pg = (int)bmi_pg;
                    if(bmi_pg - ibmi_pg > 0.5)
                        ibmi_pg = ibmi_pg +1;
                }

                else
                {
                    bmi_g  = pounds_g*703.07/(inches*inches);
                    ibmi_g = (int)bmi_g;
                    if(bmi_g - ibmi_g > 0.5)
                        ibmi_g = ibmi_g +1;
                }
                display_results(inches_display, pounds_pg, pounds_g, feet_display, ibmi_pg, ibmi_g, amp_gain,
                    elec_spac, xbmig, xbmipg, xpoundsg, xpoundspg, xfeet, xinches,
                    xelec_spac, xamp_gain, y1stline, y2ndline, y3rdline);

           }
           iter++;
        } /* End Iteration */

       


}

/*
 * Enter Header - a routine that writes the header for all the values and
 * and sets up the positions for all the variables
 */

/*void enter_header(int *p_xbmig, int *p_xbmipg, int *p_xpoundsg,
    int *p_xpoundspg, int *p_xfeet, int *p_xinches, int *p_xelec_spac,
    int *p_xamp_gain,int *p_y1stline, int *p_y2ndline, int *p_y3rdline)*/

void enter_header(int *p_xbmig, int *p_xbmipg, int *p_xpoundsg,
    int *p_xpoundspg, int *p_xfeet, int *p_xinches, int *p_xelec_spac, int *p_xamp_gain,
    int y1stline, int y2ndline, int y3rdline)


{

    char dummy[] = "****************************************";
/*    int y1stline, y2ndline, y3rdline;*/

    clrscr();

/*    gotoxy(38,3);
    printf("BMI");*/
   
/*    *p_y1stline = 7;
    *p_y2ndline = 9;
    *p_y3rdline = 11;

    y1stline = *p_y1stline;
    y2ndline = *p_y2ndline;
    y3rdline = *p_y3rdline;*/
   
    gotoxy(1,y1stline);
    printf("Hgt (ft): ");
    *p_xfeet = wherex();

    gotoxy(15,y1stline);
    printf("Hgt (in): ");
    *p_xinches = wherex();

    gotoxy(35,y1stline);
    printf("Wgt pg (lbs):  ");
    *p_xpoundspg = wherex();

    gotoxy(55,y1stline);
    printf("Wgt gvd (lbs):  ");
    *p_xpoundsg = wherex();

    gotoxy(1,y2ndline);
    printf("BMI pg:  ");
    *p_xbmipg = wherex();

    gotoxy(40, y2ndline);
    printf("BMI gvd:  ");
    *p_xbmig = wherex();

    gotoxy(1, y3rdline);
    printf("Elec Spac (cm):  ");
    *p_xelec_spac = wherex();

    gotoxy(40, y3rdline);
    printf("Amp Gain:  ");
    *p_xamp_gain = wherex();

    gotoxy(20, y3rdline + 2);
    printf("%s\n\n", dummy);
}

/*
 * Display Results - a routine to enter the results into the header created
 * with Enter Header
 */

void  display_results(int inches_display, float pounds_pg, float amp_gain,
      float pounds_g, int feet_display, int ibmi_pg, int ibmi_g, float elec_spac,
      int xbmig, int xbmipg, int xpoundsg, int xpoundspg, int xfeet, int xinches,
      int xelec_spac, int xamp_gain, int y1stline, int y2ndline, int y3rdline)

{

    gotoxy(xfeet,y1stline);
    printf("%d", feet_display);

    gotoxy(xinches,y1stline);
    printf("%d", inches_display);

    gotoxy(xpoundspg,y1stline);
    printf("%d", (int)pounds_pg);

    gotoxy(xpoundsg,y1stline);
    printf("%d", (int)pounds_g);

    gotoxy(xbmipg,y2ndline);
    printf("%d", ibmi_pg);

    gotoxy(xbmig,y2ndline);
    printf("%d", ibmi_g);

    gotoxy(xelec_spac,y3rdline);
    printf("%d", (int)elec_spac);

    gotoxy(xamp_gain,y3rdline);
    printf("%d", (int)amp_gain);

}

    fspacing = (float)spacing;
    fgain = fspacing/3.0 + 2.0;

    gain = (int)fgain;
    if(fgain - gain > 0.5)
        gain = gain +1;

    return gain;

}
====== --Boundary_(ID_x2432Oakb0QQ2yMqK5vhqA)--