-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprincipal.cpp
54 lines (45 loc) · 1.1 KB
/
principal.cpp
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
#include "conjunto.h"
#include "crimen.h"
#include "fecha.cpp"
#include <iostream>
using namespace std;
/** @brief lee un fichero de delitos, linea a linea
@param[in] s nombre del fichero
@param[in,out] C conjunto sobre el que se lee
@return true si la lectura ha sido correcta, false en caso contrario
*/
bool load(conjunto & C, const string & s) {
ifstream fe;
string cadena;
cout << "Abrimos "<< s << endl;
fe.open(s.c_str(), ifstream::in);
if (fe.fail())
{
cerr << "Error al abrir el fichero " << s << endl;
} else {
getline(fe,cadena,'\n'); //leo la cabecera del fichero
cout << cadena << endl;
while ( !fe.eof() )
{ getline(fe,cadena,'\n');
if (!fe.eof()) {
cout << "leo:: "<< cadena << endl;
// Convertir cadena a crimen
// crimen aux = cadena;
// Insertar cadena en el conjunto
// C.insert(aux);
}
}
fe.close();
return true;
} // else
fe.close();
return false;
}
int main()
{
conjunto ChicagoDB;
crimen d;
fecha f;
load(ChicagoDB, "crimenes.csv");
return 0;
}