Adding values from functions??

I need help adding up all the values that are inputted and returned by all the functions??
#include <iostream>
using namespace std;

//Function Declarations
float getLoanPayment();
float getInsurance();
float getGas();
float getOil();
float getTires();
float getMaintenance();
float totalMonthlyCosts();
float totalAnnualCosts();
void showResult(float loanPaymentCost, float insuranceCost, float gasCost, float oilCost, float tiresCost, float maintenanceCost);
float calculateTotalMonthlyCosts(float loanPaymentCost, float insuranceCost, float gasCost, float oilCost, float tiresCost, float maintenanceCost);



int main() // start of the main function

{
//Declare and Initialze Variables
float loanPaymentCost = 0;
float insuranceCost = 0;
float gasCost = 0;
float oilCost = 0;
float tiresCost = 0;
float maintenanceCost = 0;


// Loan Payment Cost
loanPaymentCost = getLoanPayment();

//Get Insurance Cost
insuranceCost = getInsurance();

//Get Gas
gasCost = getGas();

// Get Oil Cost
oilCost = getOil();

// Get Tires Cost
tiresCost = getTires();

// Get Maintenance Cost
maintenanceCost = getMaintenance();

// Display results
showResult(loanPaymentCost, insuranceCost, gasCost, oilCost, tiresCost, maintenanceCost);

// Calculate toal Monthly costs
totalMonthlyCosts(loanPaymentCost, insuranceCost, gasCost, oilCost, tiresCost, maintenanceCost);

char quitKey;
//Delay
cout << "Press any key and Enter to end program: ";
cin >> quitKey;

//End of Program
return 0;
}
// Function to get Loan Payment Cost
float getLoanPayment()
{
float loanPaymentCost;
cout << "Enter the Loan Payment Cost and press ENTER" << endl;
cin >> loanPaymentCost;
//return result
return loanPaymentCost;
}

// Function to get Insurance Cost
float getInsurance()
{
float insuranceCost;
cout << "Enter the Insurance Cost and Press Enter" << endl;
cin >> insuranceCost;
//return result
return insuranceCost;
}

// Function to get Gas Cost
float getGas()
{
float gasCost;
cout << "Enter the gas cost and Press Enter" << endl;
cin >> gasCost;
// return result
return gasCost;
}

// Function to get Oil cost
float getOil()
{
float oilCost;
cout << "Enter the oil cost and press Enter" << endl;
cin >> oilCost;
// return result
return oilCost;
}

// Function to get Tires Cost
float getTires()
{
float tiresCost;
cout << " Enter the tire cost and press Enter" << endl;
cin >> tiresCost;
// return result
return tiresCost;
}
// Function to get Maintenance cost

float getMaintenance()
{
float maintenanceCost;
cout << " Enter the maintenance cost and press Enter" << endl;
cin >> maintenanceCost;
// return result
return maintenanceCost;
}


void showResult(float loanPaymentCost, float insuranceCost, float gasCost, float oilCost, float tiresCost, float maintenanceCost)
{
//Display all the purchase amount, state tax, county tax, total tax, and total of sale
cout << "Loan Payment Cost= " << loanPaymentCost << endl;
cout << "Insurance Cost = " << insuranceCost << endl;
cout << "Gas Cost = " << gasCost << endl;
cout << "Oil Cost = " << oilCost << endl;
cout << "Tires Cost = " << tiresCost << endl;
cout << "Maintenance Cost= " << maintenanceCost << endl;
}

float calculateTotalMonthlyCosts(float loanPaymentCost, float insuranceCost, float gasCost, float oilCost, float tiresCost, float maintenanceCost)
{
float totalMonthlyCost;

float totalMonthlyCost (float loanPaymentCost, float insuranceCost, float gasCost, float oilCost, float tiresCost, float maintenanceCost)

}
Hi, please don't double triple post, the other one is better - you used code tags. :+)


http://www.cplusplus.com/forum/beginner/173586/
http://www.cplusplus.com/forum/beginner/173582/


Multiple postings are a pain, someone might do a long reply - only to discover the exact same things have been said in the other topics.
Last edited on
Topic archived. No new replies allowed.