03-10-2017, 10:42 PM
hi i am satyam i would like to know the code for airline reservation usin linked list in c language .
code for airline reservation using linked list
|
void new_reservation()
{
curr = start;
if (start == NULL)
{
//Empty list
start = curr = (struct passenger *)malloc(sizeof(struct passenger));
dataentry();
curr->next = NULL;
printf("\n\t Reservation successful");
return;
}
//Reach end of list
while (curr->next)
curr = curr->next;
curr->next = (struct passenger *)malloc(sizeof(struct passenger));
curr = curr->next;
dataentry();
curr->next = NULL;
printf("\n\t Reservation successful");
printf("\n\t Saved to Reservation list");
}
void del()
{
struct passenger *temp; // assigning a temporary pointer to struct airplane
char str[20];
printf("Enter phone number:");
gets(str);
fflush(stdin);
curr = start;
while (curr)
{
if (strcmp(start->Phone, str) == 0)
{
temp = start;
start = start->next;
free(temp);
return;
}
if (strcmp(curr->next->Phone, str) == 0)
{
temp = curr->next;
curr->next = curr->next->next;
free(temp);
break;
}
else if (strcmp(curr->next->Phone, str) != 0)
{
printf("\n\n No reservations found!!");
break;
}
}
printf("\n\n Deletion successful!!");
}
void new_reservation()
{
curr = start;
if (start == NULL)
{
//Empty list
start = curr = (struct passenger *)malloc(sizeof(struct passenger));
dataentry();
curr->next = NULL;
printf("\n\t Reservation successful");
return;
}
//Reach end of list
while (curr->next)
curr = curr->next;
curr->next = (struct passenger *)malloc(sizeof(struct passenger));
curr = curr->next;
dataentry();
curr->next = NULL;
printf("\n\t Reservation successful");
printf("\n\t Saved to Reservation list");
}
void del()
{
struct passenger *temp; // assigning a temporary pointer to struct airplane
char str[20];
printf("Enter phone number:");
gets(str);
fflush(stdin);
curr = start;
while (curr)
{
if (strcmp(start->Phone, str) == 0)
{
temp = start;
start = start->next;
free(temp);
return;
}
if (strcmp(curr->next->Phone, str) == 0)
{
temp = curr->next;
curr->next = curr->next->next;
free(temp);
break;
}
else if (strcmp(curr->next->Phone, str) != 0)
{
printf("\n\n No reservations found!!");
break;
}
}
printf("\n\n Deletion successful!!");
}
« Next Oldest | Next Newest »
|
Possibly Related Threads... | |||||
Thread | Author | Replies | Views | Last Post | |
Require Price List of Nerolac Paint | 0 | 4,263 |
29-02-2020, 01:20 PM Last Post: |
||
list of seminar topics in botany | 0 | 6,564 |
06-11-2018, 04:25 PM Last Post: Guest |
||
bus ticket reservation project pdf | 0 | 1,460 |
23-10-2018, 10:01 PM Last Post: Guest |
||
qtp flight reservation application download | 0 | 576 |
22-10-2018, 12:08 PM Last Post: Guest |
||
program for ticket reservation using multithreading in java | 0 | 1,067 |
08-10-2018, 10:00 AM Last Post: Guest |
||
reservation program using queue in c | 0 | 598 |
04-10-2018, 07:58 PM Last Post: Guest |
||
algorithm of railway reservation system | 0 | 669 |
02-10-2018, 10:50 PM Last Post: Guest |
||
mechanical engineering companies list pdf | 0 | 745 |
27-09-2018, 11:25 AM Last Post: Guest |
||
spare parts of hero honda pleasure list pdf | 0 | 658 |
20-09-2018, 11:41 PM Last Post: Guest |
||
krishi bikash shilpa kendra recruitment panel list | 0 | 805 |
19-08-2018, 09:22 PM Last Post: Guest |