Question: #include #include using namespace std; struct Passenger{ string name; time_t arrival_time; string flight_no; string flight_name; time_t departure_time; Passenger(){ this->name = ; } Passenger(string name,time_t arrival_time,string

#include #include using namespace std;

struct Passenger{ string name; time_t arrival_time; string flight_no; string flight_name; time_t departure_time; Passenger(){ this->name = "";

} Passenger(string name,time_t arrival_time,string flight_no,string flight_name,time_t departure_time){ this->name = name; this->arrival_time = arrival_time; this->flight_no = flight_no; this->flight_name = flight_name; this->departure_time = departure_time; } }; class Node { public: Passenger* data; Node *next; Node(){ this->data = new Passenger(); this->next = NULL; } Node(string name,time_t arrival_time,string flight_no,string flight_name,time_t departure_time){ this->data = new Passenger(name,arrival_time,flight_no,flight_name,departure_time); this->next = NULL; } };

class LinkedList { Node* head; Node* tail; Node* temp; bool isEmpty() { return head == NULL; } public: LinkedList() { head = new Node(); tail = new Node(); } void insert(string name,time_t arrival_time,string flight_no,string flight_name,time_t departure_time)

{ temp = new Node(name,arrival_time,flight_no,flight_name,departure_time); if(isEmpty()) { temp->next = NULL; tail = temp; } else temp->next = head; head = temp; } void remove(string flight_no) { temp = head; Node *prev; while(temp->next != NULL && temp->data->flight_no!= flight_no) { prev = temp; temp = temp->next; } if(temp->data->flight_no == flight_no) { prev->next = temp->next; delete temp; } else if(temp->next == NULL) { cout << "Error: Number Not found..." << endl; } } void display() { if(!isEmpty()) { for(temp = head; temp != NULL; temp=temp->next){ cout << "Passenger Name: "name< cout << "Flight Number: "flight_no< cout << "Flight Name: "flight_name< cout << "Arrival Time "arrival_time< cout << "Departure Time "departure_time< }

cout << endl; } else { cout << "Pseengers List is Empty!" << endl; } } }; int main() { time_t now = time(0); time_t then = time(0); LinkedList* l = new LinkedList(); l->insert("Ansh",now,"ICE-759","Lufthansa-2001",then); l->insert("vansh",now,"ICE-759","Lufthansa-2001",then); l->insert("SAAD",now,"ICE-759","Lufthansa-2001",then); l->display(); return 0; }

NOTE:

change this code into userdefined:

i want a input from user and complete time of arrival and depature

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!