"Line 53: error: too few arguments to function 'void printResult(int, double, double, double)'"
I have an "error" with my code (or so my compiler informs me) at line 53: "void printResult"

I don't see how it's possible to need more aguments in that function. Any clue on how I should procede?

#include <iostream>
#include <math.h>
#include <iomanip>

using namespace std;

void printInstructions () //Function1 Prints instructions
cout << "This is program has been made with the following goals:" << endl;
  cout << "It will ask you for the number of spools of wire ordered" << endl;
  cout << "It will display the number of spools to be sent" << endl;
  cout << "It will display the subtotal of the cost for the spools being sent" << endl;
  cout << "It will display the shipping charges for the spools being sent" << endl;
  cout << "It will display the total cost for the spools being sent" << endl;

int getNumberOfSpools () //Function2 Asks for the number of spools of wire ordered
int numberOfSpools;
cout << "Please enter number of spools: ";
cin >> numberOfSpools;
return numberOfSpools;

double computeSubTotal (int numberOfSpools) //Function3
double subtotal;
subtotal = (double) numberOfSpools* 100. ; //NoteToSelf period needed to utilize the double data-type
return subtotal;

double ComputeShipping (double subtotal) //Function4 possibly subtotal is int
double shippingCost;
shippingCost = subtotal * .05;
return shippingCost; 

double computeTotal (double subtotal, double shippingCost) //Function5 calculates the total cost including shipping
double totalCost;
totalCost = subtotal + shippingCost;
return totalCost;

void printResult (int numberOfSpools, double subtotal, double shippingCost, double totalCost) //Function6 prints results
  cout << "You ordered " << numberOfSpools<< " spools." << endl;
  cout << "The wire costs $" << subtotal << "." << endl;
  cout << "Shipping and handling cost will be $" << shippingCost << endl;
  cout << "The total order cost will be $" << totalCost<< " after S&H." << endl;

int main()

   printInstructions (); //Function1

  int nos; 
  nos = getNumberOfSpools ();//Function2

  double subTtl;
  subTtl= computeSubTotal (nos); //Function3

  double costToShip;
  costToShip = ComputeShipping (subTtl); //Function4

  double completeCost;
completeCost = computeTotal (subTtl, costToShip); //Function5

 printResult (); //Function6

return 0;
4 Years
Discussion Span
Last Post by Ubunterooster

Clear error on line 81.

You never passed anything to printResult().

It should be like printResult(integer_here, double_here, double_here, double_here).

Edited by dx9_programmer


Modify line 81.

printResult (nos, subTtl, costToShip, completeCost); //Function6

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.