title: How to debug "C++ Function does not take 0 arguments" error?
body: <p>In my C++ programming class I am tasked to create a payroll recorder for 5 employees. One of the requirement is no global variables, therefore I think this requires me to declare variables locally within each individual functions and pass them around.</p>
  
  <p>I know what the errors mean, but I don't know how to implement the solutions to them. I'm not even sure if the pass by reference/pass by value even make sense with the parameters, I can't compile because of the 3 errors regarding doCalculations(), displayPayrollSummaryResults() and displayEmployeeResults() having 0 arguments in the main(). Here is the doCalculations() I have.</p>
  
  <p>There is another function before this called getInput, where I take user input of the empID, payrollType.... and put them into payrollArray. The rest of array is used to store calculated data from this function. and a couple more functions afterwards to display the results (see complete code in the end).</p>
  
  <pre><code>void doCalculations(
          double payrollArray[12][5], 
          int &amp;empID, 
          char &amp;payrollType, 
          double &amp;hoursWorked, 
          double &amp;payRate, 
          int &amp;unionCode
          )
      {
          // Defeind Variables - Calculations
          int totalEmployee;
          double totalGrossPay;
          double totalNetPay;
          double highestGrossPay;
          double lowestGrossPay;
          double idHighestGrossPay;
          double idLowestGrossPay;
          double averageGrossPay;
          double averageNetPay;
  
          // - Pay Calucations
          double regularPay;
          double overtimePay;
          double grossPay;
          // - Tax Calculations
          double stateTax;
          double federalTax;
          double totalTax;
          // - Union Dues
          double unionDues;
          // - Net Pay
          double netPay;
  
          //Pay Calucations - Work more than 40 hours
          if( hoursWorked &gt; 40 ){
              regularPay = payRate * 40;
              overtimePay = ( 1.5 * payRate ) * ( hoursWorked - 40 );
              grossPay = regularPay + overtimePay;
          }
          //Pay Calucations - Work less than 40 hours
          else{
              regularPay = payRate * hoursWorked;
              overtimePay = 0;
              grossPay = regularPay;
          }
          //Put pay calcuations into array
          payrollArray[4][totalEmployee] = regularPay;
          payrollArray[5][totalEmployee] = overtimePay;
          payrollArray[6][totalEmployee] = grossPay;
  
          //Taxes Calculations
              // State Tax Calculations
              if( grossPay &lt; 500)
                  stateTax = 0;
              else if ( grossPay &gt;= 500 &amp;&amp; grossPay &lt;= 1000 )
                  stateTax = grossPay * 0.03;
              else if ( grossPay &gt; 1000)
                  stateTax = grossPay * 0.05;
              // Federal Tax Calculations
              if( grossPay &lt; 500)
                  federalTax = 0;
              else if ( grossPay &gt;= 500 &amp;&amp; grossPay &lt;= 1000 )
                  federalTax = grossPay * 0.05;
              else if ( grossPay &gt; 1000)
                  federalTax = grossPay * 0.07;
              totalTax = stateTax + federalTax;
          // Put Taxes into array
          payrollArray[7][totalEmployee] = stateTax;
          payrollArray[8][totalEmployee] = federalTax;
          payrollArray[9][totalEmployee] = totalTax;
  
          // Define Variables - Union dues
          if (unionCode = 1)
              unionDues = 15.00;
          else if (unionCode = 2)
              unionDues = 25.00;
          else if (unionCode = 3)
              unionDues = 35.00;
  
          // Net Pay Calculation
          netPay = grossPay - totalTax - unionDues;
  
          // Put unionDues &amp; netPay into array
          payrollArray[10][totalEmployee] = unionDues;
          payrollArray[11][totalEmployee] = netPay;
  
          // Add 1 to totalEmployee per calculation
          totalEmployee += 1;
  
          // Perpetual Summary Data Calculation
  
          // Total Gross Pay (Category 6)
          for ( int i = 0; i &lt; totalEmployee; ++i) 
          totalGrossPay += payrollArray[6][i];
  
          // Total Net Pay (Category 11)
          for ( int i = 0; i &lt; totalEmployee; ++i) 
          totalNetPay += payrollArray[11][i];
  
          // Find Employee ID number of highest gross pay
              // Compare and Find higest gross pay
              highestGrossPay = 0; // assume highest gross pay is 0 for now
              for (int grossPay = 0; grossPay &lt; totalEmployee; ++grossPay)
              {
                  if ( payrollArray[6][grossPay] &gt; highestGrossPay )
                      highestGrossPay = payrollArray[6][grossPay]; // new highestGrossPay, gross pay field is at 6.
              }
              // Using highest gross pay to find corresponding employee ID
              for (int id = 0; id &lt; totalEmployee; ++ id)
              {
                  if ( payrollArray[6][id] == highestGrossPay)
                      idHighestGrossPay = payrollArray[0][id]; // the empID field is at 0,
              }
  
          // Find Employee ID number of lowest gross pay
              // Compare and Find lowest gross pay
              lowestGrossPay = 3150; // assume lowest gross pay is maximum of 3150 for now
              for (int grossPay = 0; grossPay &lt; totalEmployee; ++grossPay)
              {
                  if ( payrollArray[6][grossPay] &lt; lowestGrossPay )
                      lowestGrossPay = payrollArray[6][grossPay]; // new lowestGrossPay, gross pay field is at 6.
              }
              // Using highest gross pay to find corresponding employee ID
              for (int id = 0; id &lt; totalEmployee; ++ id)
              {
                  if ( payrollArray[6][id] == lowestGrossPay)
                      idLowestGrossPay = payrollArray[0][id]; // the empID field is at 0,
              }
  
          // Average Gross Pay
          averageGrossPay = totalGrossPay / totalEmployee;
          // Average Net Pay
          averageNetPay = totalNetPay / totalEmployee;
      }
  </code></pre>
  
  <p>In the main() what to do with newPayroll.doCalculations("what to put here?"), I just go through trial and error with putting (double payrollArray[12][5], int &amp;empID....), not quite retaining constructor or function prototype of C++ lessons, maybe I am missing some block of codes?</p>
  
  <pre><code>int main()
  {
      // Introduction Message
      cout &lt;&lt; "WELCOME - EMPLOYEE PAYROLL RECORDER" &lt;&lt; endl;
      cout &lt;&lt; endl;
      Payroll newPayroll;
      int employeeLimit = 0; // Employee limit counter
      char addEmployee = 'y';// Initial Yes on Add Employee 
  
      do{
          newPayroll.getInput();
          newPayroll.doCalculations();
          cout &lt;&lt; "Would you want to continue adding employees? Enter [Y] or [y] for Yes." &lt;&lt; endl;
          cout &lt;&lt; "Otherwise Press Any Other Character to Stop adding more Records" &lt;&lt; endl;
          cin &gt;&gt; addEmployee;
          ++employeeLimit;
      }while((addEmployee == 'y' || addEmployee == 'Y') &amp;&amp; employeeLimit &lt; 5);
  
      cout &lt;&lt; endl; // blank line separator
  
      newPayroll.displayEmployeeResults();
  
      cout &lt;&lt; endl; // blank line separator
  
      newPayroll.displayPayrollSummaryResults();
  
      cout &lt;&lt; endl; // blank line separator
  
      system("PAUSE");
      return 0;
  }
  </code></pre>
  
  <p>Here is the complete code of the program:</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;iomanip&gt;
  
  using namespace std;
  
  // Payroll class definition
  class Payroll
  {
  
  public:
      /* getInput(), Function to accept and validates data, stores valid input data in arrays */
      void getInput()
      {   
          int empID;
          char payrollType;
          double hoursWorked;
          double payRate;
          int unionCode;
          int totalEmployee;
  
          double payrollArray[12][5]; // Initialize a 12 rows 5 coloums array for storing payroll data.
          char payrollTypeArray[1][5]; // Initialize a separate array for storing payrollType char data.
  
          cout &lt;&lt; "Please Enter Employee ID: " &lt;&lt; endl;
          cin &gt;&gt; empID;
          while( empID &lt; 100 || empID &gt; 800 ){
          cout &lt;&lt; "The Employee ID Entered is Invalid, Please Enter Employee ID (100 - 800): " &lt;&lt; endl;
          cin &gt;&gt; empID;
          }
          //put employee id into array
          payrollArray[0][totalEmployee] = empID;
  
          cout &lt;&lt; "Please Enter payroll type: " &lt;&lt; endl;
          cin &gt;&gt; payrollType;
          while( payrollType != 'H' &amp;&amp; payrollType != 'h' ){
          cout &lt;&lt; "The Payroll Type Entered is Invalid, Please Enter Payroll Type (H or h): " &lt;&lt; endl;
          cin &gt;&gt; payrollType; 
          }
          //put payrollType into array
          payrollTypeArray[1][totalEmployee] = payrollType;
  
          cout &lt;&lt; "Please Enter Hours Worked: " &lt;&lt; endl;
          cin &gt;&gt; hoursWorked;
          while( hoursWorked &lt; 0 || hoursWorked &gt; 60.0 ){
          cout &lt;&lt; "The Hours Worked Entered is Invalid, Please Enter Hours Worked (0 - 60): " &lt;&lt; endl;
          cin &gt;&gt; hoursWorked;
          }
          //put hoursWorked into array
          payrollArray[2][totalEmployee] = hoursWorked;
  
          cout &lt;&lt; "Please Enter Pay Rate: " &lt;&lt; endl;
          cin &gt;&gt; payRate;
          while( payRate &lt; 8.50 || payRate &gt; 45.00 ){
          cout &lt;&lt; "The Hourly Pay Rate Entered is Invalid, Please Enter Pay Rate (8.50 - 45.00): " &lt;&lt; endl;
          cin &gt;&gt; payRate;
          }
          //put payRate into array
          payrollArray[3][totalEmployee] = payRate;
  
          cout &lt;&lt; "Please Enter Union Code: " &lt;&lt; endl;
          cin &gt;&gt; unionCode;
          while( unionCode !=1 &amp;&amp; unionCode !=2 &amp;&amp; unionCode !=3 ){
          cout &lt;&lt; "The Union Code Entered is Invalid, Please Enter Union Code (1, 2 or 3): " &lt;&lt; endl;
          cin &gt;&gt; unionCode;
          }
      }
  
      /* doCalculations(), performs calculations using data sotred in input arrays, store
         calculation results in arrays, and accumulates totals */
      void doCalculations(
          double payrollArray[12][5], 
          int &amp;empID, 
          char &amp;payrollType, 
          double &amp;hoursWorked, 
          double &amp;payRate, 
          int &amp;unionCode
          )
      {
          // Defeind Variables - Calculations
          int totalEmployee;
          double totalGrossPay;
          double totalNetPay;
          double highestGrossPay;
          double lowestGrossPay;
          double idHighestGrossPay;
          double idLowestGrossPay;
          double averageGrossPay;
          double averageNetPay;
  
          // - Pay Calucations
          double regularPay;
          double overtimePay;
          double grossPay;
          // - Tax Calculations
          double stateTax;
          double federalTax;
          double totalTax;
          // - Union Dues
          double unionDues;
          // - Net Pay
          double netPay;
  
          //Pay Calucations - Work more than 40 hours
          if( hoursWorked &gt; 40 ){
              regularPay = payRate * 40;
              overtimePay = ( 1.5 * payRate ) * ( hoursWorked - 40 );
              grossPay = regularPay + overtimePay;
          }
          //Pay Calucations - Work less than 40 hours
          else{
              regularPay = payRate * hoursWorked;
              overtimePay = 0;
              grossPay = regularPay;
          }
          //Put pay calcuations into array
          payrollArray[4][totalEmployee] = regularPay;
          payrollArray[5][totalEmployee] = overtimePay;
          payrollArray[6][totalEmployee] = grossPay;
  
          //Taxes Calculations
              // State Tax Calculations
              if( grossPay &lt; 500)
                  stateTax = 0;
              else if ( grossPay &gt;= 500 &amp;&amp; grossPay &lt;= 1000 )
                  stateTax = grossPay * 0.03;
              else if ( grossPay &gt; 1000)
                  stateTax = grossPay * 0.05;
              // Federal Tax Calculations
              if( grossPay &lt; 500)
                  federalTax = 0;
              else if ( grossPay &gt;= 500 &amp;&amp; grossPay &lt;= 1000 )
                  federalTax = grossPay * 0.05;
              else if ( grossPay &gt; 1000)
                  federalTax = grossPay * 0.07;
              totalTax = stateTax + federalTax;
          // Put Taxes into array
          payrollArray[7][totalEmployee] = stateTax;
          payrollArray[8][totalEmployee] = federalTax;
          payrollArray[9][totalEmployee] = totalTax;
  
          // Define Variables - Union dues
          if (unionCode = 1)
              unionDues = 15.00;
          else if (unionCode = 2)
              unionDues = 25.00;
          else if (unionCode = 3)
              unionDues = 35.00;
  
          // Net Pay Calculation
          netPay = grossPay - totalTax - unionDues;
  
          // Put unionDues &amp; netPay into array
          payrollArray[10][totalEmployee] = unionDues;
          payrollArray[11][totalEmployee] = netPay;
  
          // Add 1 to totalEmployee per calculation
          totalEmployee += 1;
  
          // Perpetual Summary Data Calculation
  
          // Total Gross Pay (Category 6)
          for ( int i = 0; i &lt; totalEmployee; ++i) 
          totalGrossPay += payrollArray[6][i];
  
          // Total Net Pay (Category 11)
          for ( int i = 0; i &lt; totalEmployee; ++i) 
          totalNetPay += payrollArray[11][i];
  
          // Find Employee ID number of highest gross pay
              // Compare and Find higest gross pay
              highestGrossPay = 0; // assume highest gross pay is 0 for now
              for (int grossPay = 0; grossPay &lt; totalEmployee; ++grossPay)
              {
                  if ( payrollArray[6][grossPay] &gt; highestGrossPay )
                      highestGrossPay = payrollArray[6][grossPay]; // new highestGrossPay, gross pay field is at 6.
              }
              // Using highest gross pay to find corresponding employee ID
              for (int id = 0; id &lt; totalEmployee; ++ id)
              {
                  if ( payrollArray[6][id] == highestGrossPay)
                      idHighestGrossPay = payrollArray[0][id]; // the empID field is at 0,
              }
  
          // Find Employee ID number of lowest gross pay
              // Compare and Find lowest gross pay
              lowestGrossPay = 3150; // assume lowest gross pay is maximum of 3150 for now
              for (int grossPay = 0; grossPay &lt; totalEmployee; ++grossPay)
              {
                  if ( payrollArray[6][grossPay] &lt; lowestGrossPay )
                      lowestGrossPay = payrollArray[6][grossPay]; // new lowestGrossPay, gross pay field is at 6.
              }
              // Using highest gross pay to find corresponding employee ID
              for (int id = 0; id &lt; totalEmployee; ++ id)
              {
                  if ( payrollArray[6][id] == lowestGrossPay)
                      idLowestGrossPay = payrollArray[0][id]; // the empID field is at 0,
              }
  
          // Average Gross Pay
          averageGrossPay = totalGrossPay / totalEmployee;
          // Average Net Pay
          averageNetPay = totalNetPay / totalEmployee;
      }
  
  
  
  
      /* displayEmployeeResults(), displays employee IDs and calculations results that are stored in arrays.*/
      void displayEmployeeResults(
          double payrollArray[12][5], 
          char payrollTypeArray[1][5], 
          int &amp;totalEmployee
          ) 
      {
          int employeeCount;
          int arrayDataSetw = 5;
          int arrayTitleSetw = 12;
  
          //Display Data Array
              cout &lt;&lt; setw(50) &lt;&lt;"Individual Employee Payroll Record" &lt;&lt; endl;
              cout &lt;&lt; endl;
              // Employee ID title
              cout &lt;&lt; setw(arrayTitleSetw) &lt;&lt; "Employee ID";
                  for (employeeCount = 0; employeeCount &lt; totalEmployee; ++employeeCount)
                  cout &lt;&lt; setw(arrayDataSetw) &lt;&lt; payrollArray[0][employeeCount] &lt;&lt; setw(arrayDataSetw);
                  cout &lt;&lt; endl;
              // Payroll Type title
              cout &lt;&lt; setw(arrayTitleSetw) &lt;&lt; "Payroll Type";
                  for (employeeCount = 0; employeeCount &lt; totalEmployee; ++employeeCount)
                  cout &lt;&lt; setw(arrayDataSetw) &lt;&lt; payrollTypeArray[1][employeeCount] &lt;&lt; setw(arrayDataSetw);
                  cout &lt;&lt; endl;
              // Hours Worked title
              cout &lt;&lt; setw(arrayTitleSetw) &lt;&lt; "Hours Worked";
                  for (employeeCount = 0; employeeCount &lt; totalEmployee; ++employeeCount)
                  cout &lt;&lt; setw(arrayDataSetw) &lt;&lt; payrollArray[2][employeeCount] &lt;&lt; setw(arrayDataSetw);
                  cout &lt;&lt; endl;
              // Pay Rate title
              cout &lt;&lt; setw(arrayTitleSetw) &lt;&lt; "Pay Rate";
                  for (employeeCount = 0; employeeCount &lt; totalEmployee; ++employeeCount)
                  cout &lt;&lt; setw(arrayDataSetw) &lt;&lt; "$" &lt;&lt; payrollArray[3][employeeCount] &lt;&lt; setw(arrayDataSetw);
                  cout &lt;&lt; endl;
              // Regular Pay title
              cout &lt;&lt; setw(arrayTitleSetw) &lt;&lt; "Regular Pay";
                  for (employeeCount = 0; employeeCount &lt; totalEmployee; ++employeeCount)
                  cout &lt;&lt; setw(arrayDataSetw) &lt;&lt; "$" &lt;&lt; payrollArray[4][employeeCount] &lt;&lt; setw(arrayDataSetw);
                  cout &lt;&lt; endl;
              // Overtime Pay title
              cout &lt;&lt; setw(arrayTitleSetw) &lt;&lt; "Overtime Pay";
                  for (employeeCount = 0; employeeCount &lt; totalEmployee; ++employeeCount)
                  cout &lt;&lt; setw(arrayDataSetw) &lt;&lt; "$" &lt;&lt; payrollArray[5][employeeCount] &lt;&lt; setw(arrayDataSetw);
                  cout &lt;&lt; endl;
              // Gross Pay title
              cout &lt;&lt; setw(arrayTitleSetw) &lt;&lt; "Gross Pay";
                  for (employeeCount = 0; employeeCount &lt; totalEmployee; ++employeeCount)
                  cout &lt;&lt; setw(arrayDataSetw) &lt;&lt; "$" &lt;&lt; payrollArray[6][employeeCount] &lt;&lt; setw(arrayDataSetw);
                  cout &lt;&lt; endl;
              // State Tax title
              cout &lt;&lt; setw(arrayTitleSetw) &lt;&lt; "State Tax";
                  for (employeeCount = 0; employeeCount &lt; totalEmployee; ++employeeCount)
                  cout &lt;&lt; setw(arrayDataSetw) &lt;&lt; "$" &lt;&lt; payrollArray[7][employeeCount] &lt;&lt; setw(arrayDataSetw);
                  cout &lt;&lt; endl;
              // Federal Tax title
              cout &lt;&lt; setw(arrayTitleSetw) &lt;&lt; "Federal Tax";
                  for (employeeCount = 0; employeeCount &lt; totalEmployee; ++employeeCount)
                  cout &lt;&lt; setw(arrayDataSetw) &lt;&lt; "$" &lt;&lt; payrollArray[8][employeeCount] &lt;&lt; setw(arrayDataSetw);
                  cout &lt;&lt; endl;
              // Total Tax title
              cout &lt;&lt; setw(arrayTitleSetw) &lt;&lt; "Total Tax";
                  for (employeeCount = 0; employeeCount &lt; totalEmployee; ++employeeCount)
                  cout &lt;&lt; setw(arrayDataSetw) &lt;&lt; "$" &lt;&lt; payrollArray[9][employeeCount] &lt;&lt; setw(arrayDataSetw);
                  cout &lt;&lt; endl;
              // Union Dues title
              cout &lt;&lt; setw(arrayTitleSetw) &lt;&lt; "Union Dues";
                  for (employeeCount = 0; employeeCount &lt; totalEmployee; ++employeeCount)
                  cout &lt;&lt; setw(arrayDataSetw) &lt;&lt; "$" &lt;&lt; payrollArray[10][employeeCount] &lt;&lt; setw(arrayDataSetw);
                  cout &lt;&lt; endl;
              // Net Pay title
              cout &lt;&lt; setw(arrayTitleSetw) &lt;&lt; "Net Pay";
                  for (employeeCount = 0; employeeCount &lt; totalEmployee; ++employeeCount)
                  cout &lt;&lt; setw(arrayDataSetw) &lt;&lt; "$" &lt;&lt; payrollArray[11][employeeCount] &lt;&lt; setw(arrayDataSetw);
                  cout &lt;&lt; endl;
      }
  
      /* displayPayrollSummaryResults(), displays summary totals and averages */
      void displayPayrollSummaryResults(
          int &amp;totalEmployee, 
          double &amp;totalGrossPay, 
          double &amp;totalNetPay, 
          double &amp;idHighestGrossPay, 
          double &amp;highestGrossPay, 
          double &amp;idLowestGrossPay, 
          double &amp;lowestGrossPay, 
          double &amp;averageGrossPay, 
          double &amp;averageNetPay
          ) 
      {
          int summaryDataSetw = 47;
          // Display Summary Data
          cout &lt;&lt; setw(50) &lt;&lt;"Employee Payroll Summary" &lt;&lt; endl;
          cout &lt;&lt; endl;
          cout &lt;&lt; setw(summaryDataSetw) &lt;&lt; "Total Number of Employees on record is: " &lt;&lt; totalEmployee &lt;&lt; endl;
          cout &lt;&lt; setw(summaryDataSetw) &lt;&lt; "Total Gross Pay is: $"  &lt;&lt; totalGrossPay &lt;&lt; endl;
          cout &lt;&lt; setw(summaryDataSetw) &lt;&lt; "Total Net Pay is: $"  &lt;&lt; totalNetPay &lt;&lt; endl;
          cout &lt;&lt; setw(summaryDataSetw) &lt;&lt; "Employee with the highest gross pay: Employee #" &lt;&lt; idHighestGrossPay &lt;&lt; " earned $" &lt;&lt; highestGrossPay &lt;&lt; endl;
          cout &lt;&lt; setw(summaryDataSetw) &lt;&lt; "Employee with the lowest gross pay: Employee #" &lt;&lt; idLowestGrossPay &lt;&lt; " earned $" &lt;&lt; lowestGrossPay &lt;&lt; endl;
          cout &lt;&lt; setw(summaryDataSetw) &lt;&lt; "Average gross pay is: $"  &lt;&lt; averageGrossPay &lt;&lt; endl;
          cout &lt;&lt; setw(summaryDataSetw) &lt;&lt; "Average net pay is: $"  &lt;&lt; averageNetPay &lt;&lt; endl;
  
      }
  };
  
  int main()
  {
      // Introduction Message
      cout &lt;&lt; "WELCOME - EMPLOYEE PAYROLL RECORDER" &lt;&lt; endl;
      cout &lt;&lt; endl;
      Payroll newPayroll;
      int employeeLimit = 0; // Employee limit counter
      char addEmployee = 'y';// Initial Yes on Add Employee 
  
      do{
          newPayroll.getInput();
          newPayroll.doCalculations();
          cout &lt;&lt; "Would you want to continue adding employees? Enter [Y] or [y] for Yes." &lt;&lt; endl;
          cout &lt;&lt; "Otherwise Press Any Other Character to Stop adding more Records" &lt;&lt; endl;
          cin &gt;&gt; addEmployee;
          ++employeeLimit;
      }while((addEmployee == 'y' || addEmployee == 'Y') &amp;&amp; employeeLimit &lt; 5);
  
      cout &lt;&lt; endl; // blank line separator
  
      newPayroll.displayEmployeeResults();
  
      cout &lt;&lt; endl; // blank line separator
  
      newPayroll.displayPayrollSummaryResults();
  
      cout &lt;&lt; endl; // blank line separator
  
      system("PAUSE");
      return 0;
  }
  </code></pre>