-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
64 lines (47 loc) · 1.39 KB
/
main.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
55
56
57
58
59
60
61
62
63
64
// =================================================================
//
// File: main.cpp
// Author: Ian Joab Padrón Corona A01708940
// Date: 06-09-2022
//
// =================================================================
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
#include "header.h"
using namespace std;
int main(int argc, char *argv[]) {
ifstream inputFile;
ofstream outputFile;
int firstNumber; // Numero de registros a buscar
string tempLine, search1; // Para pasar del archivo a leer a un vector
vector<string> datos, line1;
inputFile.open(argv[1], ios::in);
outputFile.open(argv[2], ios::out);
inputFile >> firstNumber;
for (int i = 0; i <= firstNumber; i++) {
getline(inputFile, tempLine);
datos.push_back(tempLine);
}
tempLine = datos[0];
stringstream tempLine1(tempLine);
while (getline(tempLine1,tempLine,' ')) {
line1.push_back(tempLine);
}
search1 = line1[1];
vector<string> datos1;
for (int i = 1; i < datos.size(); i++) {
datos1.push_back(datos[i]);
}
vector<string> datosFiltrados = search(datos1,search1);
vector<int> dayValue = line2string(datosFiltrados);
vector<string> output = selectionSort(dayValue,datosFiltrados);
for (int i = 0; i < output.size(); i++) {
outputFile << output[i] << endl;
}
inputFile.close();
outputFile.close();
return 0;
}