-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
75 lines (56 loc) · 1.73 KB
/
Copy pathmain.cpp
File metadata and controls
75 lines (56 loc) · 1.73 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "CSVReader.h"
#include <fstream>
void leitorCSV() {
std::string x, y, z, iPos, jPos;
int sizeNetwork = 10;
//int cont = 0;
// Creating an object of CSVWriter
CSVReader reader("texte2.txt");
//std::ofstream myfile;
//myfile.open ("saida.csv");
// Get the data from CSV File
std::vector<std::vector<std::string> > dataList = reader.getData();
for (int i = 1; i <= sizeNetwork * sizeNetwork; i++) {
iPos = dataList[i][0];
jPos = dataList[i][0 + 1];
x = dataList[i][0 + 2];
y = dataList[i][0 + 3];
z = dataList[i][0 + 4];
std::cout << "i = " << iPos << std::endl;
std::cout << "j = " << jPos << std::endl;
std::cout << "x = " << x << std::endl;
std::cout << "y = " << y << std::endl;
std::cout << "z = " << z << std::endl;
std::cout << std::endl;
}
}
void organizeCSV() {
int cont = 0, linhas, colunas = 3;
// Creating an object of CSVWriter
CSVReader reader("CSVs/direita/direita7.csv");
std::ofstream myfile;
myfile.open("CSVs/newDireita/direita7.csv");
// Get the data from CSV File
std::vector<std::vector<std::string> > dataList = reader.getData();
linhas = dataList.size()/3;
myfile << linhas << " " << colunas << "\n";
for (std::vector<std::string> vec : dataList) {
for (std::string data : vec) {
myfile << data;
myfile << " ";
cont++;
if(cont == 3){
myfile << "\n";
cont = 0;
}
}
}
std::cout << dataList.size();
myfile.close();
}
int main() {
//escolher uma das duas funções
//leitorCSV();
organizeCSV();
return 0;
}