-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathRafaMedidas.cpp
More file actions
151 lines (141 loc) · 4.8 KB
/
RafaMedidas.cpp
File metadata and controls
151 lines (141 loc) · 4.8 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#include "MedidasBase.h"
/*------------------ Derived class RafaMedidas from MedidasBase ------------------*/
class RafaMedidas: public MedidasBase{
public:
void imprimeAlpha(){
for(int i2=0;i2<46;i2++){
cout << alphas[i2] << "\n";
}
}
void lerAlphas(int emotion){
ifstream infilestream;
string line;
string line2;
float n;
int i=0;
if (emotion==1) infilestream.open("1_Alfas_Neutra_Satisfação.txt");
if (emotion==2) infilestream.open("2_Alfas_Neutra_Tristeza.txt");
if (emotion==3) infilestream.open("3_Alfas_Neutra_Surpresa.txt");
if (emotion==4) infilestream.open("4_Alfas_Neutra_Medo.txt");
if (emotion==5) infilestream.open("5_Alfas_Neutra_Raiva.txt");
if (emotion==6) infilestream.open("6_Alfas_Neutra_Aversao.txt");
for(int x=0;x<5;x++){
infilestream >> line;
}
//SEsquerda
for(int x=0;x<3;x++){
infilestream >> line;
}
for(int x=0;x<6;x++){
infilestream >> line;
infilestream >> line;
infilestream >> n;
alphas[i++]=n;
}
//SDireita
for(int x=0;x<3;x++){
infilestream >> line;
}
for(int x=0;x<6;x++){
infilestream >> line;
infilestream >> line;
infilestream >> n;
alphas[i++]=n;
}
//Oesquerdo
for(int x=0;x<3;x++){
infilestream >> line;
}
for(int x=0;x<8;x++){
infilestream >> line;
infilestream >> line;
infilestream >> n;
alphas[i++]=n;
}
//Odireito
for(int x=0;x<3;x++){
infilestream >> line;
}
for(int x=0;x<8;x++){
infilestream >> line;
infilestream >> line;
infilestream >> n;
alphas[i++]=n;
}
//Nariz
for(int x=0;x<2;x++){
infilestream >> line;
}
for(int x=0;x<10;x++){
infilestream >> line;
infilestream >> line;
infilestream >> n;
alphas[i++]=n;
}
//Boca
for(int x=0;x<2;x++){
infilestream >> line;
}
for(int x=0;x<8;x++){
infilestream >> line;
infilestream >> line;
infilestream >> n;
alphas[i++]=n;
}
infilestream.close();
}
/*----------------------------------------------------*/
void lerGrafo(Grafo*grafo){
ifstream infilestream;
string line;
//N
int tipo;
string id;
//R
int no1;
int no2;
int i=0;
infilestream.open("grafo.txt");
while (infilestream) {
infilestream >> line;
if(line=="N") {
infilestream >> tipo;
infilestream >> id;
criaNo(tipo,id, grafo);
}
if(line=="F") {
infilestream >> tipo;
float coo;
infilestream >> coo;
infilestream >> id;
criaNoFolha(tipo,id, coo,grafo);
}
if(line=="R") {
infilestream >> no1;
infilestream >> no2;
criaRelacaoBin(no1, no2, grafo);
}
}
cont=0;
infilestream.close();
//grafo.buscaAndOr(grafo.n[0]);
}
/*----------------------------------------------------*/
void criaNo(int tipo,string valor, Grafo *g){
// printf("[[criando no %i %i]]\n",tipo, cont);
No n0(tipo,cont,valor,0);
g->n[cont]=n0;
cont++;
}
void criaNoFolha(int tipo,string valor,float coo, Grafo *g){
// printf("[[criando no %i %i]]\n",tipo, cont);
No n0(tipo,cont,valor,coo);
g->n[cont]=n0;
cont++;
}
void criaRelacaoBin(int pai,int filho,Grafo * g){
// printf("[[criando aresta %i %i]]\n",pai, filho);
g->adicionarAresta(g->n[pai],g->n[filho]);
g->copiaArestas(&g->n[pai]);
}
};