-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCaja.h
108 lines (104 loc) · 2.87 KB
/
Caja.h
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
#ifndef CAJA_H
#define CAJA_H
#include<string>
#include<iostream>
#include<fstream>
#include<list>
#include "Objeto.h"
using namespace std;
class Caja
{
public:
list<float>puntos;
Caja(string nombre,list<float> puntos,list<float>minMax){
this->nombre=nombre;
this->puntos=puntos;
this->minMax=minMax;
}
list<float> getPuntos(){
return this->puntos;
}
list<float> getMinMax(){
return this->minMax;
}
string getNombre(){
return this->nombre;
}
void setPuntos(list<float> x){
this->puntos=x;
}
void setMinMax(list<float> x){
this->minMax=x;
}
void setNombre(string x){
this->nombre=x;
}
void imprimirCaja(){
int h=0,s=0;
cout<<"Nombre de la caja: "<<nombre<<endl;
cout<<"PUNTO MINIMO ";
for(std::list<float>::iterator it=minMax.begin(); it != minMax.end();it++){
cout<<*it<<" ";
if(s==2){
cout<<endl<<"PUNTO MAXIMO ";
s++;
}
if(h==2){
h=0;
}
else{
h++;
s++;
}
}
cout<<endl;
cout<<"PUNTOS DE LA CAJA ENVOLVENTE"<<endl;
for(std::list<float>::iterator it=puntos.begin(); it != puntos.end();it++){
cout<<*it<<" ";
if(h==2){
cout<<endl;
h=0;
}
else{
h++;
}
}
}
void escribirDatos(string x){
ofstream salida((x+".doc").c_str(),ios::out);
int h=0,s=0;
salida<<"Nombre de la caja: "<<nombre<<endl;
salida<<"PUNTO MINIMO ";
for(std::list<float>::iterator it=minMax.begin(); it != minMax.end();it++){
salida<<*it<<" ";
if(s==2){
salida<<endl<<"PUNTO MAXIMO ";
s++;
}
if(h==2){
h=0;
}
else{
h++;
s++;
}
}
salida<<endl;
salida<<"PUNTOS DE LA CAJA ENVOLVENTE"<<endl;
for(std::list<float>::iterator it=puntos.begin(); it != puntos.end();it++){
salida<<*it<<" ";
if(h==2){
salida<<endl;
h=0;
}
else{
h++;
}
}
}
protected:
private:
list<float> minMax;
string nombre;
};
#endif // CAJA_H