Outputting data from a file

I am getting a LNK2019 unresolved external symbol saying totalAmount(void) and employeeName(void) referenced in function_main. In short it isn't compiling and any reference to something to read that would guide me would be appreciated. Also if you wanted to know if you haven't noticed it's just outputting data from a file under the hoursWorked hourlyRate etc.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>

using namespace std;


void instruction();
void reportTitle();
void employeeInfo();
void totalAmount();

int main()
{
	
	
	string employeeName;
	double hourlyRate, hoursWorked, taxRate, grossAmount = 0.0, netAmount = 0.0, totalGrossAmount = 0.0, totalNetAmount = 0.0;
	

	ifstream inFile;

	
	instruction();
	
	reportTitle();
	
	employeeInfo();
	
	totalAmount();


	
	inFile.open("payroll.txt");
	
	
	if (!inFile)
	{
		cout << "File not found.";
			return 1;
	}

	
	getline(inFile, employeeName, '#');
	inFile >> hourlyRate >> hoursWorked >> taxRate;
	 inFile.ignore(100,'\n');
	
	while(!inFile.eof())
	{
		//calculate the gross amount
		grossAmount = hourlyRate * hoursWorked;
		//calculate the overtime if applicable
		if (hoursWorked > 40)
		{
			grossAmount = grossAmount + hoursWorked +(taxRate * hoursWorked * 0.5);
		}
		else (hoursWorked <= 40);
		{
			grossAmount = grossAmount;
		}
		//calculate the net amount
		netAmount += grossAmount;

		//calculate total gross amount
		totalGrossAmount += grossAmount;
		//calculate total net amount
		totalNetAmount = totalNetAmount + netAmount;	
		
	
	
		getline(inFile, employeeName, '#');
		inFile >> hourlyRate >> hoursWorked >> taxRate;
		inFile.ignore(100, '\n');
	}

	
	inFile.close();
	return 0;
}


void instruction()
{
	
	cout << "This payroll program calculates individual employee pay and "
		<< "company totals using data from a data file payroll.txt." << endl << endl;

}


void reportTitle()
{
	
	cout << setprecision(2) << fixed << showpoint << left;
	
	cout << 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;
	
	
}
void employeeInfo(string employeeName,double hourlyRate,double hoursWorked, double taxRate,double grossAmount,double netAmount)
{
    cout << setprecision(2) << fixed << showpoint << left;
	cout << setw(20) << employeeName << setw(10) << hourlyRate << setw(10) << hoursWorked << setw(10) << taxRate << setw(10) << grossAmount << setw(10) << netAmount << endl;
	
}
//the function totalAmount display the total gross amount and total net amount
void totalAmount(double totalGrossAmount, double totalNetAmount)
{
	

}
employeeInfo(string employeeName...

totalAmount(double totalGrossAmount, double totalNetAmount)
{


both expect arguements but you dont have no matching parameters in your prototypes and you havn't passed any arguements in your function calls.

Thanks for the fairly quick reply I was just trying to practice overwriting voids from actual to formal parameters.
no prob. did it help?

... also
when you protype you must you must include data types that match the header of the func def(names are optional in protos')

but to "overlaod" (not overwrite, in classes you can "override" but that is through polymorhism which is entirely different), you must prototype and define each overlaoded version of any function

//example w/ minimal prototype (again names in protos are opt.)
//prototype

void employeeInfo(string,double ,double , double ,double ,double );

// def header

void employeeInfo(string employeeName,double hourlyRate,double hoursWorked, double taxRate,double grossAmount,double netAmount)
{ ... body ... }

//overloaded ficticiuos example (note: number & type of arguments must
// be different or you'll get an ambiguity problem @ compile.

void employeeInfo(string,double , double ,int,double );

// overloaded def header
void employeeInfo(string employeeName,double commisionRate,double bonusRate, int salesCompleted, double grossAmount)
{ ... body ... }

here this would say overload employeeInfo to handle both hourly and commision employees w/ same func name but w/ different "methods"

i hope this helps
Topic archived. No new replies allowed.