Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 7th, 2012  |  syntax: None  |  size: 1.14 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. void quepassa::CrearConversacion() {
  2.         Conversacion Con, conver;
  3.         PilaConversaciones P;
  4.         Contacto C;
  5.         string N, cad;
  6.         bool est = false;
  7.         bool enc = false;
  8.         int num;
  9.  
  10.         cout << "Nombre del destinatario: " << endl;
  11.         getline(cin,N);
  12.         C.PutNombre(N);
  13.  
  14.         if (BuscarContacto(C) == true) {
  15.                 cout << "Primer mensaje" << endl;
  16.                 getline(cin,cad);
  17.                 Con.PutReceptor(N);
  18.                 Con.PutTexto(cad);
  19.  
  20.                 if (chat.estaVacia())
  21.                         num = 0;
  22.                 else {
  23.                 chat.Cima(conver);
  24.                     conver.GetIdentificador(num);
  25.                     num=num+1;
  26.                 }
  27.                 Con.PutIdentificador(num);
  28.  
  29.                 if (!chat.estaLleno())
  30.                         chat.Apilar(Con);
  31.                 else {
  32.                         while (!chat.estaVacia()) {
  33.                                 chat.Cima(conver);
  34.                                 P.Apilar(conver);
  35.                                 chat.Desapilar();
  36.                         }
  37.                         while (!P.estaVacia() && !enc) {
  38.                                 P.Cima(conver);
  39.                                 conver.GetEstado(est);
  40.                                 if (est == false) {
  41.                                         P.Desapilar();
  42.                                         enc = true;
  43.                                 }
  44.                                 else {
  45.                                         chat.Apilar(conver);
  46.                                         P.Desapilar();
  47.                                 }
  48.                         }
  49.                         while (!P.estaVacia()) {
  50.                                 P.Cima(conver);
  51.                                 chat.Apilar(conver);
  52.                                 P.Desapilar();
  53.                         }
  54.                         chat.Apilar(Con);
  55.                 }
  56.         }
  57.         else
  58.                 cout << "El contacto no esta en tu lista de contactos." << endl;
  59. }