
Untitled
By: a guest on
May 7th, 2012 | syntax:
None | size: 1.14 KB | hits: 14 | expires: Never
void quepassa::CrearConversacion() {
Conversacion Con, conver;
PilaConversaciones P;
Contacto C;
string N, cad;
bool est = false;
bool enc = false;
int num;
cout << "Nombre del destinatario: " << endl;
getline(cin,N);
C.PutNombre(N);
if (BuscarContacto(C) == true) {
cout << "Primer mensaje" << endl;
getline(cin,cad);
Con.PutReceptor(N);
Con.PutTexto(cad);
if (chat.estaVacia())
num = 0;
else {
chat.Cima(conver);
conver.GetIdentificador(num);
num=num+1;
}
Con.PutIdentificador(num);
if (!chat.estaLleno())
chat.Apilar(Con);
else {
while (!chat.estaVacia()) {
chat.Cima(conver);
P.Apilar(conver);
chat.Desapilar();
}
while (!P.estaVacia() && !enc) {
P.Cima(conver);
conver.GetEstado(est);
if (est == false) {
P.Desapilar();
enc = true;
}
else {
chat.Apilar(conver);
P.Desapilar();
}
}
while (!P.estaVacia()) {
P.Cima(conver);
chat.Apilar(conver);
P.Desapilar();
}
chat.Apilar(Con);
}
}
else
cout << "El contacto no esta en tu lista de contactos." << endl;
}