Could someone help me?
I have an file in which a list of employees and salaries are listed for each year
ex:
Year: 2005
No. of Employees: 3
Employee ID Salary
123456 36000.00
123567 32000.00
123678 33000.00
Year: 2006
No. of Employees: 4
Employee ID Salary
133456 31000.00
133567 32000.00
133678 33000.00
How do I open all these data into arrays?
This is my code, and I don't think it is good since it only reads the lines and not the data#include<iostream>
#include<fstream>
#include<string>
#include<iomanip>
using namespace std;
int main()
{
int counter;
string countLines[20];
ifstream indata;
indata.open("employee.txt");
for(counter=0;counter<=20;counter++)
{
getline(indata,countLines[counter]);
cout<<countLines[counter]<<endl;
}
indata.close();
return 0;
}