Example of Using Structures - 2

Now, we can use these structures to declare variables:
InputCost carpetCost;  // represents all inputs
TotalCost totalCost;   // represents calculated
The getData(. . .) function must be declared differently. This is how it is currently declared:
void getData(int customer,
             int &sqYards, 
             float &costPerSqYard, 
             float &discountPercentage,
             float &laborPerSqYard, 
             float &floorPrep);
This is the new declaration:
void getData(int customer, InputCost &inputs);
Similarly, the calculateCosts(. . .) function is modified from this:
void calculateCosts(int sqYards, 
                    float costPerSqYard,
                    float laborPerSqYard,
                    float discountPercentage, 
                    float floorPrep,
                    float &carpetCost,
                    float &laborCost,
                    float &carpetDiscount,
                    float &totalTax,
                    float &totalCharge);
to this:
void calculateCosts(InputCost inputs,
                    TotalCost &outputs);
Previous page
Next page

Back to Lesson 14 Index
Back to Outline