This is my header file i want to use

#include <stdio.h>
#define my
#define LABOR_COST 0.35
#define TAX_RATE .085

void read_data(int* length, int* width, int* customerdiscount, double* costpersquarefoot);

void calculate_values(int length, int width, int customerdiscount, double costpersquarefoot, int* area,
                          double* carpetcharge, double* laborcharge, double* installedpricecharge,
                          double* discountcharge, double* subtotalcharge, double* taxcharge, double* totalcharge);

void calculate_installedprice(int length, int width, int customerdiscount, double costpersquarefoot, int* area,
                                 double* carpetcharge, double* laborcharge, double* installedpricecharge);

void calculate_subtotal(double* discountcharge, double* subtotalcharge, double carpetcharge, double laborcharge, int customerdiscount);

void calculate_price(double* taxcharge, double* totalcharge, double subtotalcharge);

void printresults(int length, int width, int area, double carpetcharge, double laborcharge, double installedpricecharge,
                      double discountcharge, double subtotalcharge, double taxcharge, double totalcharge, double costpersquarefoot);

void printmeasurements(int length, int width, int area);

void printcharges(double carpetcharge, double laborcharge, double installedpricecharge, double discountcharge,
                      double totalcharge, double taxcharge, double mcostpersquarefoot, double subtotalcharge );

this is my main:

#include <stdio.h>
#include "my.h"


int main(void)
{
int length, width, customerdiscount, area;
double costpersquarefoot, carpetcharge, laborcharge, installedpricecharge, discountcharge, subtotalcharge, taxcharge, totalcharge;

read_data(&length, &width, &customerdiscount, &costpersquarefoot);

calculate_values(length, width, customerdiscount, costpersquarefoot, &area,
                          &carpetcharge, &laborcharge, &installedpricecharge,
                          &discountcharge, &subtotalcharge, &taxcharge, &totalcharge);

printresults(length, width, area, carpetcharge, laborcharge, installedpricecharge,
                    discountcharge, subtotalcharge, taxcharge, totalcharge, costpersquarefoot);


return 0;
}

these are a couple of my functions:

#include "my.h"
#include <stdio.h>

void read_data(int* length, int* width, int* customerdiscount, double* costpersquarefoot)
{
printf("Length of room (feet)?");
scanf("%d\n", *length);

printf("Width of room (feet)?");
scanf("%d\n", *width);

printf("Customer discount (percent)?");
scanf("%d\n", *customerdiscount);
printf("Cost per square foot (xxx.xx)?");
scanf("%6.2f\n", *costpersquarefoot);

 return;
}
#include "my.h"
#include <stdio.h>


void calculate_values(int length, int width, int customerdiscount, double costpersquarefoot, int* area,
                          double* carpetcharge, double* laborcharge, double* installedpricecharge,
                          double* discountcharge, double* subtotalcharge, double* taxcharge, double* totalcharge)

{
calculate_installedprice(length, width, customerdiscount, costpersquarefoot, &area,
                                 &carpetcharge, &laborcharge, &installedpricecharge);

calculate_subtotal(&discountcharge, &subtotalcharge, carpetcharge, laborcharge, customerdiscount);

calculate_price(&taxcharge, &totalcharge, subtotalcharge);


return;
}

what i'm having a problem with is the pointers are not working the way i need them to and im getting a winmain@16 error when i compile. no matter how much i read about pointers i don't fully understand them. Any help would be great.

In this function im getting an error that says invalid operands to binary -(have double and double*)

#include "my.h"
#include <stdio.h>


calculate_subtotal(double* discountcharge, double* subtotalcharge, double carpetcharge, double laborcharge, int customerdiscount)

{

customerdiscount = customerdiscount/100;

*discountcharge = carpetcharge + laborcharge * customerdiscount;
*subtotalcharge = laborcharge+carpetcharge-discountcharge;
return ;
}

This is my header file i want to use

#include "my.h"
#include <stdio.h>

void read_data(int* length, int* width, int* customerdiscount, double* costpersquarefoot)
{
printf("Length of room (feet)?");
scanf("%d\n", *length);//should be scanf("%d\n", length);

printf("Width of room (feet)?");
scanf("%d\n", *width);//should be scanf("%d\n", width);

printf("Customer discount (percent)?");
scanf("%d\n", *customerdiscount);//should be scanf("%d\n", customerdiscount);
printf("Cost per square foot (xxx.xx)?");
scanf("%6.2f\n", *costpersquarefoot);//should be scanf("%6.2f\n", costpersquarefoot);

 return;
}

You should read up on how scanf works.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.