Program will not compile, when using arrays

I did this program. In the Data.txt I have the employee name, wage and hours on the same line like this:

Clinton 9.75 10
Lincoln 5.00 50
Washington 35 32.00
Kennedy 45 4.99
Nixon 25 9.75

I did the program right and it worked until I added the arrays. I need to put the data from Data.txt file into three arrays. Since I did a loop, I put them into these three arrays: employee_name[1], hourly_wage[1], and hours_worked[1]. But for some reason, it won't compile correctly and the error that it gives me is one I have never seen. It opens a tab next to my .cpp file tab in Visual Studio named 'iosfwd'. I have no clue what that is...this is what says in my output debug screen:

'Lab 2.exe': Loaded 'C:\Users\Moshe Rafailov\Desktop\Coding\Lab 2\Debug\Lab 2.exe', Symbols loaded.
'Lab 2.exe': Loaded 'C:\Windows\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Lab 2.exe': Loaded 'C:\Program Files\AVAST Software\Avast\snxhk.dll', Cannot find or open the PDB file
'Lab 2.exe': Loaded 'C:\Windows\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Lab 2.exe': Loaded 'C:\Windows\SysWOW64\KernelBase.dll', Cannot find or open the PDB file
'Lab 2.exe': Loaded 'C:\Windows\SysWOW64\msvcp100d.dll', Symbols loaded.
'Lab 2.exe': Loaded 'C:\Windows\SysWOW64\msvcr100d.dll', Symbols loaded.
First-chance exception at 0x00397516 in Lab 2.exe: 0xC0000005: Access violation writing location 0x94e83379.
Unhandled exception at 0x00397516 in Lab 2.exe: 0xC0000005: Access violation writing location 0x94e83379.

My errors are mostly in the Report_Data, and Read_Data functions.
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/***************************************************************/
/*      This program will calculate the employee payroll       */
/*		with the data from the 'Data.txt' file and display     */
/*		it on the screen. It will also calculate the number    */
/*		of employees in the file, max & min wage as well       */
/*		as average pay. It will display the bonus if legible.  */
/***************************************************************/

#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <cstdlib>
using namespace std;

void Report_Data(ifstream& myReadFile, ofstream& myWriteFile);
void Read_Data(ifstream& myReadFile, ofstream& myWriteFile);             //Function Prototype
void Print_Summary ();

/***************************************************************/
/*		The 'Main' Function will open the reading and writing  */
/*		file and check for open errors. It will then call the  */
/*		functions and end the program once the functions are   */
/*		complete.                                              */
/***************************************************************/
int main()
{
	string Data_File = "Data.txt";
	string Payroll_File = "Employee Payroll.txt";

	ifstream myReadFile;                                // Local Declarations.
	ofstream myWriteFile;

	myReadFile.open(Data_File.c_str());                 // Open 'Data.txt' for reading.
	if(myReadFile.fail())
	{
		cout << "The file was not successfully opened." << endl;
		exit(1);
	}

	myWriteFile.open(Payroll_File.c_str());            // Open 'Employee Payroll.txt' for writing.
	if(myWriteFile.fail())
	{
		cout << "The file was not successfully opened." << endl;
		exit(1);
	}

	Report_Data(myReadFile, myWriteFile);             // Function calls.
	Read_Data(myReadFile, myWriteFile);
	Print_Summary();

	getchar();
	return 0;
}  // End Program.
/***************************************************************/
/*		The 'Report_Data' function will read data from the     */
/*		'Data.txt' file and calculate the number of employees  */
/*		max and min wage, average wage, and bonus.             */
/*		Then write all the information to the file             */
/*		'Emplyoee Payroll.txt'.                                */
/***************************************************************/
void Report_Data(ifstream& myReadFile, ofstream& myWriteFile)
{
	string employee_name[1];
	double hourly_wage[1];                                // Local Declarations
	double hours_worked[1];

	int NumOfEmployees = 0;
	double Max_Pay = 0, Min_Pay = 0, Total_Pay = 0, Average_Pay;

	while(!myReadFile.eof())                              // Read data from 'Data.txt'.
	{
		NumOfEmployees++;   // Calculate number of employees in file.

		myReadFile >> employee_name[1] >> hourly_wage[1] >> hours_worked[1];

		if(Max_Pay < hourly_wage[1]) // Calculate Maximum wage.
			Max_Pay = hourly_wage[1];

		if(Min_Pay == 0)      // Calculate Minimum wage.
				Min_Pay = hourly_wage[1];
		else
			{
				if(Min_Pay > hourly_wage[1])
				{
					Min_Pay = hourly_wage[1];
				}
			}
		Total_Pay = Total_Pay + hourly_wage[1];
	}
	Average_Pay = Total_Pay / NumOfEmployees;   // Calculate Average wage.

	// Write all calculated data to 'Employee Payroll.txt'.
	myWriteFile << "Number of Employees: " << NumOfEmployees << endl
				<< "Maximum Pay Rate: " << Max_Pay << endl
				<< "Minimum Pay Rate: " << Min_Pay << endl
				<< "Average Pay Rate: " << Average_Pay << endl;

	return;
}
/********************************************************/
/*		'Read_Data' Function will open 'Data.txt' file  */
/*		and once again read all the data. It will then  */
/*		create a table with all information including   */
/*		bonus pay.                                      */
/********************************************************/
void Read_Data(ifstream& myReadFile, ofstream& myWriteFile)
{
	string employee_name[1];
	double hourly_wage[1];         // Local Declarations.
	double hours_worked[1];
	double gross, adjusted_gross;

	myWriteFile << "_____________________" << endl
				<< "November 2012 Payroll" << endl
				<< "_____________________" << endl
				<< "      Name    Hours     Rate      Gross      Bonus   Adjusted-Gross" << endl
				<< "      ----    -----     ----      -----      -----   --------------" << endl;

	myReadFile.seekg(0);    // Start at the beginning of the file.
	myReadFile.clear();

	while(!myReadFile.eof())
	{
		myReadFile >> employee_name[1] >> hourly_wage[1] >> hours_worked[1];   // Read data from file.

		gross = hourly_wage[1] * hours_worked[1];

		myWriteFile << setw(10) << employee_name                             // Write all data for each employee to file line by line.
					<< setw(9) << setprecision(0) << hours_worked;
		myWriteFile << setw(9) << setiosflags(ios::fixed) << setprecision(2) << hourly_wage
					<< setw(11) << gross;

		if(hours_worked[1] > 45)          // Calculate bonus.
			{
				adjusted_gross = gross + 50.00;

				myWriteFile << setw(11) << "Yes"
							<< setw(17) << adjusted_gross
							<< endl;
			}
			else if(hours_worked[1] <= 45 && hours_worked[1] >= 30)
				{
					adjusted_gross = gross;

					myWriteFile << setw(11) << "No"
								<< setw(17) << adjusted_gross
								<< endl;
				}
			else if(hours_worked[1] < 30)
				{
					adjusted_gross = gross - (hours_worked[1] * 0.25);
					myWriteFile << setw(11) << "No"
								<< setw(17) << adjusted_gross
								<< endl;
				}
	}

	return;
}
/*******************************************************************/
/*		'Pring_Summary' function will open 'Employee Payroll.txt'  */
/*		file and output all the data in the file to the output     */
/*		Screen.                                                    */
/*******************************************************************/
void Print_Summary ()
{
	ifstream myReadFile;

	string Payroll_File = "Employee Payroll.txt";
	string textRead;

	int line = 0;

	myReadFile.open(Payroll_File.c_str());           // Open 'Employee Payroll.txt' for reading.
	if(myReadFile.fail())
	{
		cout << "The file was not successfully opened." << endl;
		exit(1);
	}
	while(line != 1)
	{
		getline(myReadFile, textRead);
		cout << textRead << endl;        // Display line by line to output screen.

		if(textRead == "")
			line++;
	}

	return;
}


I know it's a lot but I would really appreciate the help.
Topic archived. No new replies allowed.