Please point out where specifically as well as what new specific edits need to be made. I keep getting the same errors and I have no idea what is wrong. I've cecked brackes a million times and am pretty sure I'm doing this right:
- cpp:36: error: a function-definition is not allowed here before ‘{’ token
- cpp:44: error: a function-definition is not allowed here before ‘{’ token
- cpp:58: error: expected initializer before ‘double’
- cpp:63: error: a function-definition is not allowed here before ‘{’ token
- cpp:69: error: a function-definition is not allowed here before ‘{’ token
Code:
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
int main()
{   
    string item = "";
    ifstream fin;
    double tgross = 0;
    double tnet = 0;
    double hourly;
    double hours;
    double taxrate;
    double net;
    string fileName = "payroll.txt";    
    fin.open("payroll.txt");
    if(!fin.is_open())
    {   
        void instructions() 
        {
            cout << "This payroll program calculates an individual employee pay and";
            cout << "\ncompany totals using data from a data file payroll.txt.\n"; 
            cout << "\n\nA payroll report showing payroll information ";
            cout << " is displayed.\n\n";
        }
        void reportTitle() 
        {
            cout << setprecision(2) << fixed << showpoint << left
                << setw(20) << "Employee" << setw(10) << "Hourly" << setw(10) << "Hours"
                << setw(10) << "Tax" << setw(10) << "Gross" << setw(10) << "Net" << endl;
            cout << setw(20) << "Name" << setw(10) << "Rate" << setw(10) << "Worked"
                << setw(10) << "Rate" << setw(10) << "Amount" << setw(10) << "Amount" << endl;
        }
    }
    while(!fin.eof())
    {
        getline(fin,item,'#');
        fin >> hourly >> hours >> taxrate;
        double calculateGross(double hours, double hourly)
        double calculateNet(double grosspay, double netpercent)
        {
            return grosspay - grosspay*netpercent/100.0;
        }
        void displayEmployeeInfo(const string &, double, double, double, double, double)
        {
            tgross += grosspay;
            tnet += net;
        }
    }
    void totalAmounts (double tgross, double tnet)
    {
        cout << "Totals" << setprecision(2) << fixed << showpoint << right
            << setw(50) << tgross << setw(10) << tnet << endl;
    }
    fin.close();
}
 
     
     
    