home
clear breadcrumbs
search
login
 
prototype
#include
using namespace std; // double finalCost(double, double); // funtion prototype // or // double finalCost(double, double tax = 0.10); // funtion prototype - tax parameter assigned value double finalCost(double, double tax = 0.10); void main() { double baseCost{}; cout << "Enter base cost: "; cin >> baseCost; cout << endl; cout << "The total cost is $" << finalCost(baseCost); // function call cout << endl; cout << endl; } double finalCost(double baseCost, double tax) { // function definition return baseCost + baseCost * tax; // output not formated }