call compute_tax

Hi, Im new at C++, and I do not know how to write a call to the function for my practice sheet : write a call to the function for compute_tax in the main program/ [code]

Written by: Joshua Kelly
Date: 12-02-13

double compute_tax(double item1_cost, double item2_cost, double tax_rate);
#include <cstdlib>
#include <iostream>
#include <iomanip>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
using namespace std;
int main(int argc, char* argv[])
double item1_cost; //cost of the first item entered by the user
double item2_cost; //cost of the second item entered by the user
double tax_rate; //percent tax rate
double tax; // tax on the given item
double total_cost; // cost of item plus tax

cout<< "Enter the cost of item 1: $";
cout<< "Enter the cost of item 2: $";
cout<<"Enter the tax rate (percent): ";
cin>> tax_rate;

// call to your function here

total_cost=item1_cost+ item2_cost+tax;

cout<< showpoint<<fixed<<setprecision(2);
cout<<"\nThe tax on your items is: $" <<tax;
cout<<"\nThe total cost of the items is: $" << total_cost<<"\n\n";


//define the compute_tax function definition here
//compute_tax returns the tax on the sum of the items given the cost of
//the two items and the tax rate as parameters.

If someone can help me out, I would appreciate it! Thank you!
Hint1: general outline for a function call:
function_name(argument_1, argument_2, etc.)
The number of arguments depends on the function in question, ranging from zero to a lot.

Hint2: your call should store the return value
tax = *function call*;
This way the return value is stored into the tax variable instead of disappearing after the function call.
Topic archived. No new replies allowed.