I have never seen such a problem...
If you have any questions, it is best not to mislead or contradict the details. It is better not to explain the details.
/* <Br/> airline ticket booking system <br/> 1 Problem description <br/> business activities of airline ticket booking include querying routes, booking tickets, and returning tickets. <Br/> Design an airline ticket booking system so that the above businesses can be completed by computer. <Br/> 1.1 The information of each route includes the terminal name, flight number, plane number, and flight Sunday (the day of the week), <br/> Number of passengers, number of remaining tickets, and list of customers who have booked tickets (including name, ticket quantity, class 1, 2, or 3) and the list of customers waiting for replacement (including names and required tickets) <br/> 1.2 as a moting system, all data can be stored in the memory. <br/> 1.3 The system can perform the following operations and functions: <br/> 1.3.1 query route: output the following information based on the passenger's terminal Name: flight number, flight number, day of the week, date of the last day and remaining ticket amount <br/> 1.3.2 ticket booking business: according to the requirements of the customer (flight number, ticket amount) query the amount of the flight ticket. If there is still a remaining ticket, <br/> the customer will go through the ticket booking procedure and output the seat number. If the amount of the ticket is already full or less than the amount of the ticket, ask the customer's requirements again. If necessary, you can register a waiting queue <br/> 1.3.3 to accept the refund service: Follow the customer's instructions (date and flight) to return the ticket to the customer, then, check whether there is a waiting queue for the flight. <br/> first, ask the customer in the first place. If the refund can meet his requirements, the ticket booking procedure will be handled for him, otherwise, you will be asked about other waiting customers in the queue <br/> */<br/> # include <stdio. h> <br/> # include <string. h> <br/> # include <iostream> <br/> # include <queue> <br/> using namespace STD; <br/> typedef Enum status {error, OK }; <br/> const int maxc = 20; // Name Length <br/> const int maxn = 30; // maximum number of flights <br/> class passenger {// customer booking and Registration Information <br/> Public: <br/> friend class passengerqueue; <br/> friend class ticketsystem; <br/> pasend (): Next (null) {}< br/> passenger (char * s, int _ T, int _ B): ticketbuy (_ T), bunkclass (_ B), next (null) {strcpy (name, S) ;}< br/> void display () {cout <"name:" <name <"Number of votes: "<ticketbuy <" class: "<bunkclass ;}< br/> PRIVATE: <br/> char name [maxc]; <br/> int ticketbuy; <br/> int bunkclass; <br/> passenger * Next; <br/ >}; <Br/> class passengerqueue {// customer queue <br/> Public: <br/> passengerqueue (): Head (), rear (& head) {}< br/> void push (passenger P); <br/> void POP (); <br/> bool empty (); <br/> passenger top (); <br/> passenger * Find (INT booknum); <br/> passenger * Find (char * Name); <br/> PRIVATE: <br/> passenger head, * rear; <br/>}; <br/> class flightnode {// Flight Information <br/> Public: <br/> flightnode () {}< br/> flightnode (char *, Int, I NT, INT); <br/> void display (); <br/> void book (INT); <br/> void wait (INT ); <br/> char name [maxc]; <br/> int flightnum; <br/> int planenum; <br/> int day; <br/> int uplimit; <br/> int ticketleft; <br/> passengerqueue already, wait; <br/> }; <br/> class ticketsystem {// main functions of the ticket booking system <br/> Public: <br/> ticketsystem () {flightn = 0 ;} <br/> Status queryflight (); <br/> Status bookticket (); <br/> Status bounceticket (); <br/> Vo Id addflight (flightnode); <br/> PRIVATE: <br/> flightnode flight [maxn]; <br/> int flightn; <br/> }; <br/> //////////////////////////////////// //////////////////////////////////////// ///// <br/> // main functions of the customer queue <br/> bool passengerqueue:: Empty () <br/>{< br/> return head. next = NULL; <br/>}< br/> void passengerqueue: Push (passenger P) <br/>{< br/> rear = rear-> next = new passenger (p); <br/>}< br/> void passengerq Ueue: Pop () <br/>{< br/> passenger * P = head. next; <br/> head. next = p-> next; <br/> Delete P; <br/>}< br/> passenger passengerqueue: Top () <br/> {<br/> return * head. next; <br/>}< br/> passenger * passengerqueue: Find (INT booknum) <br/>{< br/> passenger * P = & head, * q; <br/> while (p-> next) {<br/> If (p-> next-> ticketbuy <= booknum) break; <br/> P = p-> next; <br/>}< br/> q = p-> next; <br/> If (q = NULL) return n Ull; <br/> P-> next = Q-> next; <br/> return Q; <br/>}< br/> passenger * passengerqueue :: find (char * Name) <br/>{< br/> passenger * P = & head, * q; <br/> while (p-> next) {<br/> If (! Strcmp (p-> next-> name, name) break; <br/> P = p-> next; <br/>}< br/> q = p-> next; <br/> If (q = NULL) return NULL; <br/> P-> next = Q-> next; <br/> return Q; <br/>}< br/> // main functions of the customer queue <br/> ///////////////////// //////////////////////////////////////// /// // <br/> /////////////// //////////////////////////////////////// /// // main functions of the flight <br/> // <br/> flightnode:: flightnode (char * _ n, Int _ F, int _ p, int _ d, int _ u, int _ t) <br/>{< br/> strcpy (name, _ n ); <br/> flightnum = _ F; <br/> planenum = _ p; <br/> day = _ d; <br/> uplimit = _ u; <br/> ticketleft = _ t; <br/>}< br/> void flightnode: Display () <br/>{< br/> cout <"flight No: "<flightnum <"/T Aircraft No.: "<planenum; <br/> cout <"/t flight times per week: "<day <"/T total number of votes "<uplimit <"/T remaining votes: "<ticketleft <Endl; <br/>}< br/> void flightnode: Book (INT B Ooknum) <br/>{< br/> char name [maxc]; <br/> int bunkclass; <br/> cout <"enter your name and the required position number (1/2/3):"; <br/> CIN> Name> bunkclass; <br/> already. push (passenger (name, booknum, bunkclass); <br/> cout <"ticket booking successful! Your seat number: "<uplimit-ticketleft + 1 <" to "<(uplimit-ticketleft) + booknum <". /N "; <br/> ticketleft-= booknum; <br/>}< br/> void flightnode: Wait (INT booknum) <br/>{< br/> char name [maxc]; <br/> int bunkclass; <br/> cout <"enter your name and the required position number (1/2/3):"; <br/> CIN> Name> bunkclass; <br/> wait. push (passenger (name, booknum, bunkclass); <br/> cout <"your information has been registered! "<Endl; <br/>}< br/> // main flight functions <br/> ////////////////////// //////////////////////////////////////// /// // <br/> //////////////// //////////////////////////////////////// /// // main functions of the ticket booking system <br/> // void ticketsystem:: addflight (flightnode f) <br/>{< br/> flight [flightn ++] = f; <br/>}< br/> Status ticketsystem: queryflight () <br/>{< br/> char _ name [maxc]; <br/> cout <"Enter Enter the destination: "; <br/> CIN >>_name; <br/> int I; <br/> int status = error; <br/> for (I = 0; I <flightn; I ++) {<br/> If (! Strcmp (flight [I]. name, _ name) {<br/> flight [I]. display (); <br/> Status = OK; <br/>}< br/> return (Status) status; <br/>}< br/> Status ticketsystem: bookticket () <br/>{< br/> int flightnum, booknum; <br/> cout <"Enter the flight number and ticket count you want to book:"; <br/> CIN> flightnum> booknum; <br/> int I; <br/> char ch; <br/> for (I = 0; I <flightn; I ++) {<br/> If (flightnum = Flight [I]. flightnum) break; <br/>}< br/> if (I = FLI Ghtn) {<br/> cout <"sorry, this flight does not exist. "<Endl; <br/> return error; <br/>}// this flight does not exist <br/> If (flight [I]. ticketleft> = booknum) {<br/> flight [I]. book (booknum); <br/>}else {<br/> cout <"there are not so many seats. Do you need to register? (Y/n) "<Endl; <br/> CIN> CH; <br/> If (CH = 'y ') {<br/> flight [I]. wait (booknum); <br/>}< br/> Return OK; <br/>}< br/> Status ticketsystem: bounceticket () <br/>{< br/> int day, flightnum; <br/> cout <"Enter the time you want to unsubscribe (the day of the week) and flight number :"; <br/> CIN> day> flightnum; <br/> int I; <br/> char name [maxn]; <br/> passenger * P; <br/> for (I = 0; I <flightn; I ++) {<br/> If (flight [I]. day = day & flightnum = flig HT [I]. flightnum) break; <br/>}< br/> if (I = flightn) {<br/> cout <"the flight cannot be found. "<Endl; <br/> return error; <br/>}< br/> cout <" enter your name :"; <br/> CIN> name; <br/> P = Flight [I]. already. find (name); <br/> If (P = NULL) {<br/> cout <"Your name is incorrect! "<Endl; <br/>}else {<br/> (* P ). display (); <br/> flight [I]. ticketleft + = (* P ). ticketbuy; <br/> Delete P; <br/> cout <"the ticket has been canceled for you. "<Endl; <br/> If (! Flight [I]. wait. empty () {<br/> P = Flight [I]. wait. find (flight [I]. uplimit-flight [I]. ticketleft); <br/> If (! P) Return OK; <br/> flight [I]. already. push (* P); <br/> Delete P; <br/>}< br/> Return OK; <br/>}< br/> // main functions of the ticket booking system <br/> ///////////////////// //////////////////////////////////////// /// // <br/> void _ test () <br/>{< br/> ticketsystem t; // fpdut <br/> int N; <br/> // The maximum number of weeks for the flight No. Ending flight No. can be accommodated <br/> T. addflight (flightnode ("USA", 1,); <br/> T. addflight (flightnode ("India", 3,); <br/> T. A Ddflight (flightnode ("Japan", 3, 8, 2, 3, 33); <br/> T. addflight (flightnode ("India", 3,); <br/> T. addflight (flightnode ("Vietnam", 4,); <br/> T. addflight (flightnode ("North Korea", 5,); <br/> T. addflight (flightnode ("Philippines", 0,); <br/> T. addflight (flightnode ("France", 8, 3, 5, 5); <br/> T. addflight (flightnode ("Russia", 5,); <br/> T. addflight (flightnode ("USA", 10, 1, 3, 2, 2); </P> <p> while (True) {<br/> cout <"/n/T welcome to the airline ticket booking system/N "; <br/> cout <"/T ++ ++/N "; <br/> cout <"/t + 1. query function +/N "; <br/> cout <"/T + 2. ticket Booking Function +/N "; <br/> cout <"/T + 3. refund Function +/N "; <br/> cout <"/T + 4. exit +/N "; <br/> cout <"/T ++ ++/N "; <br/> cout <"/n/T select:"; <br/> CIN> N; <br/> switch (N) <br/>{< br/> case 1: T. queryflight (); break; // query function <br /> Case 2: T. bookticket (); break; // ticket booking function <br/> case 3: T. bounceticket (); break; // return function <br/> case 4: return; <br/> default: cout <"incorrect input! /N "; // exit <br/>}< br/> system (" pause "); <br/> system (" CLS "); <br/>}< br/> int main () <br/>{< br/>__ test (); <br/>}