-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
56 lines (43 loc) · 1.5 KB
/
main.cpp
File metadata and controls
56 lines (43 loc) · 1.5 KB
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
#include <iostream>
#include <fstream>
#include "arbol.h"
#include "empleado.h"
#include "empleadoPorHoras.h"
#include "empleadoPorNomina.h"
using namespace std;
int main()
{
Arbol *arbol = new Arbol();
string linea {};
//1. "Personas.txt"
ifstream lectorPersonas("/home/andres/Desktop/Test/Homework/Emergency/obj/Personas.txt",ifstream::in);
if(!lectorPersonas.is_open()){cerr << "No logró abrirse \"Personas.txt\"" << endl;return -1;}
getline(lectorPersonas,linea);
arbol->agregueDirector(linea);
while(getline(lectorPersonas,linea))
{
arbol->agregueEmpleado(linea);
}
lectorPersonas.close();
//2. "Nomina.txt"
ifstream lectorNomina("/home/andres/Desktop/Test/Homework/Emergency/obj/Nomina.txt",ifstream::in);
if(!lectorNomina.is_open()){cerr << "No logró abrirse \"Nomina.txt\"" << endl;return -1;}
while(getline(lectorNomina,linea))
{
arbol->genereMonto(linea);
}
lectorNomina.close();
//3. "HorasTrabajadas.txt"
ifstream lectorHoras("/home/andres/Desktop/Test/Homework/Emergency/obj/HorasTrabajadas.txt",ifstream::in);
if(!lectorHoras.is_open()){cerr << "No logró abrirse \"HorasTrabajadas.txt\"" << endl;return -1;}
while(getline(lectorHoras,linea))
{
arbol->genereMonto(linea);
}
lectorHoras.close();
//4. Salida
ofstream escritor("/home/andres/Desktop/Test/Homework/Emergency/obj/Reporte.csv",ostream::out);
escritor << *arbol;
escritor.close();
delete arbol;
}