In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
< 1 || time >7) {printf ("- Please enter the correct departure time (1-7 from Monday to Sunday):";} else {ahead- > time = time; break;}} aend = ahead Aend- > next = NULL;} else {printf ("- Please enter flight number (return by 0):"); getchar (); while (gets (airlinenum)) {if (strcmp (airlinenum, "0") = = 0) {return } if (strlen (airlinenum) airlinenum,airlinenum) = = 0) {flag = 1; break;} p = p-> next;} if (flag = = 1) {int ticks Printf ("- Please enter the number of tickets to be increased:"); while (scanf ("% d", & ticks)) {if (ticks 999) {printf ("- Please enter the number of tickets within 0-999!") ;} else {p-> ticks + = ticks; printf ("- flight number% s votes added successfully!" , p-> airlinenum); break;} else {p = (airline*) malloc (sizeof (airline)); strcpy (p-> airlinenum,airlinenum); printf ("- Please enter plane number:"); long long int airplanenum While (scanf ("% lld", & airplanenum)) {if (airplanenum 999999) {printf ("- Please enter a plane number with a length of 1-6 digits:");} else {p-> airplanenum = airplanenum; break }} printf ("- Please enter the place of departure:"); getchar (); char dep [1000]; while (gets (dep)) {if (strlen (dep) dep,dep); break } else {printf ("- Please enter a place of departure with a length of 1 to 16 digits:");}} printf ("- Please enter a destination:"); char des [1000] While (gets (des)) {if (strlen (des) des,des); break;} else {printf ("- Please enter a destination with a length of 1 to 16 bits:") }} printf ("- Please enter the number of tickets:"); int ticks; while (scanf ("% d", & ticks)) {if (ticks)
< 0) { printf("-------------请输入正确格式的机票数!"); } else if (ticks >) {printf ("- Please enter the number of tickets within 0-999!") ;} else {p-> ticks = ticks; break;}} int time; printf ("- Please enter the departure time (1-7):"); while (scanf ("% d", & time)) {if (time)
< 1 || time >7) {printf ("- Please enter the correct departure time (1-7 from Monday to Sunday);} else {p-> time = time; break;}} getchar (); aend- > next = p Aend = p; aend- > next = NULL;}} acnt + +; writefile (2); cls (); printf ("\ n\ n"); printf ("\ t\ t *\ n") Printf ("\ t\ t *\ n"); printf ("\ t\ t flight number% s added successfully!\ n", aend- > airlinenum); printf ("\ t\ t *\ n") Printf ("\ t\ t *\ n"); printf ("the page is about to jump..."); Sleep (2000);} void writefile (int flag) / / 0 write user 1 write administrator 2 write flight {user * userp = uhead; manger * mangerp = mhead; airline * airlinep = ahead; FILE * fp If (flag = = 0) {fp = fopen ("user", "w"); while (userp) {fwrite (userp,sizeof (user), 1mai FP); userp = userp- > next;}} else if (flag = = 1) {fp = fopen ("manger", "w") While (mangerp) {fwrite (mangerp,sizeof (manger), 1Magne FP); mangerp = mangerp- > next;}} else if (flag = = 2) {fp = fopen ("airline", "w"); while (airlinep) {fwrite (airlinep,sizeof (airline), 1Magne FP); airlinep = airlinep- > next } fclose (fp);} void deletenum () {airline * p, * sign; p = ahead; char airlinenum [1000]; int flag = 0; FILE * fp; fp = fopen ("airline", "r"); char ch; ch = fgetc (fp); rewind (fp); if (ch = = EOF) {printf ("\ n\ n") Printf ("- No flight information yet!") ; getchar (); printf ("pause"); return;} printf ("- Please enter the flight number you want to delete (press 0 to exit):"); while (scanf ("% s", airlinenum)) {if (strcmp ("0", airlinenum) = = 0) {getchar (); return } while (p) {if (strcmp (p-> airlinenum,airlinenum) = = 0) {flag = 1; break;} p = p-> next } if (flag = = 0) {printf ("- check no such flight!") ; printf ("Please re-enter (exit by 0):"); p = ahead;} else {break;}} deleteusernum (airlinenum); p = ahead; if (strcmp (ahead- > airlinenum,airlinenum) = = 0) {sign = ahead; strcpy (sign- > airlinenum,ahead- > airlinenum); ahead = ahead- > next Ahead1- > next = ahead;} while (p-> next! = NULL) {if (strcmp (p-> next- > airlinenum,airlinenum) = = 0) {sign = p-> next; strcpy (sign- > airlinenum,p- > next- > airlinenum); p-> next = p-> next- > next; break;} p = p-> next;} getchar () Printf ("\ n\ n"); printf ("- flight number% s deleted successfully! \ n ", sign- > airlinenum); printf ("-the page is about to jump... "); Sleep (1000); / / free (sign); writefile (2);} void deleteusernum (char * airlinenum) {user * userp = uhead; int flag; while (userp) {flag = 1; for (int I = 0; I)
< userp->Bookcnt; I + +) {if (strcmp (userp- > bookticks [I], airlinenum) = = 0) {flag = I; break;}} if (flag! = 1) {for (int j = flag; j)
< userp->Bookcnt-1; j + +) {strcpy (userp- > bookticks [j], userp- > bookticks [j + 1]);} userp- > bookcnt -;} userp = userp- > next;} writefile (0);} void changeairline () {airline * airlinep = ahead1- > next; char airlinenum [2000]; int airplanenum, time, ticks; char dep [2000], des [2000] Int exist = 0; int flag = 0; printf ("\ n\ n"); FILE * fp; fp = fopen ("airline", "r"); char ch; ch = fgetc (fp); rewind (fp); if (ch = = EOF) {printf ("\ n\ n") Printf ("- No flight information yet!") ; getchar (); getchar (); return;} printf ("flight number\ t\ t flight number\ t\ t departure\ t\ t destination\ t\ t\ t departure time\ t\ t votes\ n"); while (airlinep) {printf (PRINTF); airlinep = airlinep- > next;} airlinep = ahead Printf ("- Please enter the flight number you want to modify (return by 0):"); / / getchar (); while (gets (airlinenum)) {if (strcmp ("0", airlinenum) = = 0) {return } while (airlinep) {if (strcmp (airlinep- > airlinenum,airlinenum) = = 0) {exist = 1; break;} airlinep = airlinep- > next;} if (! exist) {airlinep = ahead Printf ("- the flight was not found! Please re-enter: ");} else {break;}} if (! exist) {return;} else {int choose; cls (); changemenu (); while (1) {printf ("-Please enter the action you want to do: ") Scanf (% d, & choose); switch (choose) {case 1: printf ("- Please enter the modified flight number:"); scanf ("% s", airlinenum); changeuserairline (airlinep- > airlinenum,airlinenum) Strcpy (airlinep- > airlinenum,airlinenum); break; case 2: printf ("- Please enter the modified flight number:"); scanf ("% lld", & airplanenum); airlinep- > airplanenum = airplanenum Break; case 3: printf ("- Please enter the modified place of departure:"); scanf ("% s", dep); strcpy (airlinep- > dep,dep); break Case 4: printf ("- Please enter the modified destination:"); scanf ("% s", des); strcpy (airlinep- > des,des); break Case 5: printf ("- Please enter modified departure time:"); while (scanf ("% d", & time)) {if (time)
< 1 || time >7) {printf ("- Please enter the correct departure time (1-7 from Monday to Sunday):";} else {airlinep- > time = time Break;}} break; case 6: printf ("- Please enter the revised number of tickets:") While (scanf ("% d", & ticks)) {if (ticks 999) {printf ("- Please enter the number of tickets within 0-999!") ;} else {airlinep- > ticks = ticks; break;}} break Case 7: flag = 1; break;} if (flag) {break;}} writefile (2);} void changeuserairline (char * userbookticks, char * bookticks) {user * userp = uhead While (userp) {for (int I = 0; I)
< userp->Bookcnt; I + +) {if (strcmp (userp- > bookticks [I], userbookticks) = 0) {strcpy (userp- > bookticks [I], bookticks);} userp = userp- > next;} writefile (0);} void searchuser () {user * userp = uhead; char username [2000]; int flag = 0 Printf ("- Please enter the passenger name you want to query (press 0 to exit):"); gets (username); if (strcmp (username, "0") = = 0) {return;} while (userp) {if (strcmp (userp- > username,username) = = 0) {flag = 1; break } userp = userp- > next;} if (! flag) {cls (); printf ("\ n\ n"); printf ("\ t\ t *\ n") Printf ("\ t\ t *\ n"); printf ("\ t\ t * passenger information does not exist! * *\ n "); printf ("\ t\ t * jump to the previous page. * *\ n "); printf ("\ t\ t *\ n ") Printf ("\ t\ t *\ n"); Sleep (2000); return;} else {long long int sign; while (1) {cls (); printf ("\ n\ n") Printf ("\ t\ t personal information of passenger% s\ n", userp- > username); printf ("\ t\ t *\ n"); printf ("\ t\ t passenger account number:") Puts (userp- > username); printf ("\ t\ t *\ n"); printf ("\ t\ t passenger password:"); puts (userp- > scert) Printf ("\ t\ t *\ n"); printf ("\ t\ t booking times:"); printf ("% d\ n", userp- > bookcnt) Printf ("\ t\ t *\ n"); if (userp- > bookcnt) {printf ("\ t\ t booking flight number:"); for (int I = 0; I
< userp->Bookcnt; I + +) {printf ("% s", userp- > bookticks [I]);} printf ("\ n"); printf ("\ t\ t *\ n") } else {printf ("\ t\ t\ t this passenger has not booked any flight yet! \ n ");} printf (" enter 0 to return to the previous page! "); while (scanf ("% lld ", & sign)) {if (sign = = 0) {return } else {printf ("invalid input! Please re-enter: ");}} void bookticks (user * userp) {char airlinenum [2000]; airline * airlinep = ahead1- > next; int exist = 0; int sign = 1; printf ("\ n\ n "); FILE * fp; fp = fopen (" airline "," r "); char ch Ch = fgetc (fp); if (ch = = EOF) {printf ("- No flight information!") ; getchar (); return;} printf ("flight number\ t\ t aircraft number\ t\ t departure place\ t destination\ t\ t departure time\ t\ t votes\ n"); while (airlinep) {printf (PRINTF); airlinep = airlinep- > next } printf ("- Please enter the flight number you want to book (press 0 to exit):"); getchar (); gets (airlinenum); airlinep = ahead; if (strcmp ("0", airlinenum) = = 0) {return } while (airlinep) {if (strcmp (airlinep- > airlinenum,airlinenum) = = 0) {if (airlinep- > ticks = = 0) {printf ("- there are no tickets available for this flight! \ n "); sign = 0;} else {int n; printf ("-Please enter the number of tickets to book: "); while (scanf ("% d ", & n)) {if (airlinep- > ticks)
< n) { printf("-------------机票数量不够!请重新输入:"); } else if (airlinep->Ticks > = n) {userp- > ticks + = n; airlinep- > ticks-= n; break;}} userp- > bookcnt + +; strcpy (userp- > bookticks [Userp-> bookcnt-1], airlinenum) / / userp- > usertime = airlinep- > time; writefile (0); writefile (2); exist = 1; break;}} airlinep = airlinep- > next } if (exist = = 0 & & sign = = 1) {printf ("- this flight does not exist! \ n ");} else if (exist = = 1) {printf ("-flight% s booked successfully! \ n ", airlinep- > airlinenum);} printf ("-the page is about to jump... "); Sleep (2000);} void returnticks (user * userp) {airline * airlinep = ahead; char airlinenum [2000]; int exist = 0; int flag = 0; int cnt = userp- > bookcnt; if (cnt = 0) {printf ("\ n\ n ") Printf ("\ t\ t you haven't booked any flight!") ; getchar (); return;} printf ("\ n\ n"); for (int I = 0; I
< cnt; i ++) { printf("-------------第%d次预订的航班号:",i + 1); printf("%s\n",userp->Bookticks [I]);} printf ("- Please enter the flight number to return the ticket (press 0 to exit):"); getchar (); while (gets (airlinenum)) {if (strcmp (airlinenum, "0") = = 0) {return;} for (int I = 0; I
< userp->Bookcnt; I + +) {if (strcmp (airlinenum,userp- > bookticks [I]) = = 0) {flag = I; exist = 1; break;}} if (! exist) {printf ("- to find the flight number! \ n "); printf ("-Please re-enter the flight number (press 0 to exit): ");} else {break;}} int n While (airlinep) {if (strcmp (airlinep- > airlinenum,airlinenum) = = 0) {printf ("- Please enter the number of tickets to be cancelled:"); while (scanf ("% d", & n)) {if (userp- > ticks)
< n) { printf("-------------您未持有此数量票量!\n"); printf("-------------请重新输入:"); } else if (userp->Ticks > = n) {userp- > ticks-= n; airlinep- > ticks + = n; break;} airlinep = airlinep- > next;} if (userp- > ticks = = 0) {for (int I = flag; I)
< userp->Bookcnt-1; I + +) {strcpy (userp- > bookticks [I], userp- > bookticks [I + 1]);} userp- > bookcnt -;} writefile (0); writefile (2); printf ("-% s flight refund successful! \ n ", userp- > bookticks [flag]; printf ("-about to return to the previous page. "); Sleep (2000);} void findairline (user * userp) {int cnt = userp- > bookcnt; long long sign; if (cnt = 0) {printf ("\ n\ n ") Printf ("\ t\ t you haven't booked any flights yet! \ n ");} printf ("\ n\ n "); for (int I = 0; I
< cnt; i ++) { printf("\t\t\t\t\t\t第%d次预订的航班号:%s\t第%d预定航班的票数:%d\n",i + 1, userp->Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.