This repository has been archived by the owner on Oct 23, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
/
Copy pathpeda.cpp
113 lines (91 loc) · 2.93 KB
/
peda.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
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
#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
using namespace std;
class Persona
{
private:
string nombre;
bool estaPeda = false;
bool estaIntoxicada = false;
public:
void setNombre(string nombre) { this->nombre = nombre; }
void setEstaPeda(bool estaPeda) { this->estaPeda = estaPeda; }
void setEstaIntoxicada(bool estaIntoxicada) { this->estaIntoxicada = estaIntoxicada; }
string getNombre() { return this->nombre; }
};
class Peda : public Persona
{
private:
bool alcohol;
bool cigarros;
bool comida;
vector<Persona> personas;
bool alguienEstaPeda = false;
bool alguienSeIntoxico = false;
public:
Peda(bool alcohol, bool cigarros, bool comida)
{
this->alcohol = alcohol;
this->cigarros = cigarros;
this->comida = comida;
cout << "Se esta armando la peda.\n" << endl;
}
void invitar(int invitaciones)
{
string nombre;
this->personas.resize(invitaciones);
for(int i=0; i<invitaciones; i++)
{
cout << "ingresa el nombre del invitado " << i+1 << ": "; cin >> nombre;
this->personas[i].setNombre(nombre);
}
cout << endl;
}
bool seArmo() { if(this->personas.size()>=20 and this->alcohol == true) { return true; } else { return false; } }
void alcoholizar()
{
srand(time(NULL));
for(int i=0; i<this->personas.size(); i++)
{
if(rand() % 2)
{
personas[i].setEstaPeda(true);
cout << personas[i].getNombre() << " esta PEDA!" << endl;
this->alguienEstaPeda = true;
}
}
cout << endl;
}
void Intoxicar()
{
srand(time(NULL));
for(int i=0; i<this->personas.size(); i++)
{
if(rand() % 2)
{
personas[i].setEstaIntoxicada(true);
cout << personas[i].getNombre() << " se INTOXICO!" << endl;
this->alguienSeIntoxico = true;
}
}
cout << endl;
}
bool esSegura() { if(this->alguienEstaPeda or this->alguienSeIntoxico){ return false; } else { return true; } }
~Peda() { cout << "\n\nSe acabo la peda." << endl; }
};
int main()
{
int invitaciones;
Peda *peda = new Peda(true, true, true);
cout << "cuantos vas a invitar: "; cin >> invitaciones; cout << endl;
peda->invitar(invitaciones);
if(peda->seArmo())
{
peda->alcoholizar();
peda->Intoxicar();
if(peda->esSegura()) { cout << "pasala tranqui prro"; } else { cout << "Sal de ahiii!!!"; }
} else { cout << "No se armo :c"; }
delete(peda);
}