The illustration shows the following code segment with lines numbered 1 through 38:
#include <iostream>
using namespace std;
double totalCost(int numberPar, double pricePar); annotated as "function declaration/function prototype”
//Computes the total cost, including 5% sales tax,
//on numberPar items at a cost of pricePar each.
int main( )
{
double price, bill;
int number;
cout << "Enter the number of items purchased: ";
cin >> number;
cout << "Enter the price per item $";
cin >> price;
bill = totalCost(number, price); annotated as "function call"
cout.setf(ios::fixed);
cout.setf(ios::showpoint);
cout.precision(2);
cout << number << " items at "
<< "$" << price << " each.\n"
<< "Final bill, including tax, is $" << bill
<< endl;
return 0;
}
double totalCost(int numberPar, double pricePar)
{
const double TAX_RATE = 0.05; //5% sales tax
double subtotal;
subtotal = pricePar * numberPar;
return (subtotal + subtotal * TAX_RATE);
} with the line 31 "double totalCost(int numberPar, double pricePar)" annotated as "function heading," and the block under the heading annotated as "function body." Both "function heading" and "function body" are annotated as "function definition."