Advertisement
Guest User

Untitled

a guest
May 29th, 2017
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.47 KB | None | 0 0
  1. int main (void){
  2.     banner();
  3.     int i, k, selection, switchN = 0;                                                                                              
  4.     cstring title [] = {"See Appointment" ,"Delete Appointment", "Archive Appointments", "Exit" };
  5.     date* D;
  6.    
  7.  
  8.  
  9.     Family familyList;
  10.     familyList.print();
  11.  
  12.     ToDo list(&familyList);
  13.    
  14.     for( i = 0; i<2; ++i)
  15.     {
  16.     list.addappt(appointment::makeAppt(&familyList));
  17.     }
  18.  
  19.     cout << "\n" << list << "\n"; //seems to be crashing here
  20. }
  21.  
  22. ToDo::ToDo(Family* x)
  23. {
  24.     time_t incDate;
  25.     char incName [30];
  26.     struct tm tmpTime;
  27.     appointment* a;
  28.     vector <person*> tmp;
  29.     person* tmpPerson;
  30.     ofstream stream;
  31.    
  32.  
  33.     int k, j;
  34.     //------------------------
  35.     head = NULL;
  36.     scan = NULL;
  37.     follow = NULL;
  38.  
  39.     ifstream myFile( "appts list" );
  40.     cout << "\nFile Opened\n";
  41.  
  42.     myFile >> incName >> incDate;
  43.     char* tempTime = ctime( & incDate );
  44.     cout << tempTime;
  45.  
  46.     tmpTime = *localtime( & incDate );
  47.  
  48.     cout << "\n------------------------------\n"
  49.         << "Date is being constructed from file....\n";
  50.     date D(incDate, tmpTime);
  51.    
  52.    
  53.    
  54.  
  55.     tmp = x->getArray();                                    //accesses vector in Famiily class
  56.     for(k = 0; k < tmp.size(); ++k ){                       //loop to located correct person in vector                         
  57.         j = strcmp(incName, tmp[k]->getName());
  58.         if( j == 0){
  59.             tmpPerson = tmp[k];                        
  60.         }
  61.     }
  62.  
  63.     cout << "\n----------------------------------\n"
  64.         << "Appointment being created from file....\n";
  65.     a= new appointment (&D, tmpPerson);
  66.  
  67.     /*cout << A;*/
  68.     cout << "ToDo Built\n";
  69.     addappt(a);
  70.     print(stream);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement