c i studied c for 1 month now and i want the codes for this program
This is a discussion on help i need the codes for this within the C Programming forums, part of the General Programming Boards category; c i studied c for 1 month now and i want the codes for this program...
c i studied c for 1 month now and i want the codes for this program
Last edited by gwendolyne; 11-15-2010 at 11:58 AM.
I think you will be failing this course.
thnx for supporting
it would be much easier to help you if you have a little bit of code to begin with...
this forum isn't here to do your homework for you ^^
C Board - Announcements in Forum : General Programming Boards
but we can help if you are having problems somewhere...
Because Tetris Is Unrealistic.
"The fear of death is the most unjustified of all fears, for there's no risk of accident for someone who's dead." - Albert Einstein
"The Edge... there is no honest way to explain it because the only people who really know where it is are the ones who have gone over." - Hunter S. Thompson
"I never think of the future. It comes soon enough." - Albert Einstein
I think the least you could do is take this seriously and stop using "sms talk" to describe what you perceive to be a serious problem. You haven't even bothered to write proper English so I can imagine how much effort you are willing to put into getting your homework done.
1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
3. Get rid of conio.h and other antiquated DOS crap headers.
4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.
c i did some of it :
and here wat we should do :Code:#include <stdio.h> #include <ctype.h> #include <conio.h> void mainmenu(void); void menu_PurchaseTicket(void); void menu_chooseTicket(void); void menu_BizClass(void); void menu_EconomyClass(void); void menu_DepartureBizKL(void); void menu_DepartureBizLK(void); void menu_DepartureEconKL(void); void menu_DepartureEconLK(void); void menu_ViewSeating(void); void menu_ChooseDestination(void); void menu_ChooseTime(void); void menu_ChooseSeat(void); int exit_ViewSeating, cust_TicketClass, cust_Destination, cust_Time, cust_Seat; char MenuSelect,TicketSelect,BizClassSelect,EconomyClassSelect,ViewSeatingSelect; main() { mainmenu(); } void mainmenu() { printf("\n\t\t\t\t--WELCOME TO--"); printf("\n\t\t<<<< AIRLINE RESERVATION SYSTEM >>>> \n"); printf("\n\n\t\t\t\t%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"); printf("\n\t\t\t\t%%%%%% Main Menu %%%%%%%\n"); printf("\t\t\t\t%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n"); printf("\n\t\t\t\tP to Purchase Ticket\n"); printf("\n\t\t\t\tV to View Seating Arrangement\n"); printf("\n\t\t\t\tQ to Quit the system\n\n"); printf("\n\n\t\t\t\tPlease enter your choice:"); fflush(stdin); MenuSelect = getchar(); switch(MenuSelect) { case 'P': case 'p': menu_PurchaseTicket(); break; case 'V': case 'v': menu_ViewSeating(); break; case 'Q': case 'q': printf("Thank you for choosing Airlines Reservation System"); break; default: printf("Please enter the correct selection"); } } void menu_PurchaseTicket() { menu_chooseTicket(); menu_ChooseDestination(); menu_ChooseTime(); menu_ViewSeating(); menu_ChooseSeat(); int seat[cust_TicketClass][cust_Destination][cust_Time][cust_Seat]; int a,b,c,d; for(a=0;a<2;a++) { if(cust_TicketClass == 0) printf("Business Class"); else printf("Economy Class"); for(b=0;b<2;b++) { if(cust_Destination == 0) printf("Destination: Kuala Lumpur --> Langkawi\n\n"); else printf("Destination: Langkawi --> Kuala Lumpur\n\n"); for(c=0;c<5;c++) { switch(cust_Time) { case '1': printf("Departure Time: 9.00 a.m\n"); case '2': printf("Departure Time: 11.00 a.m\n"); case '3': printf("Departure Time: 1.00 p.m\n"); case '4': printf("Departure Time: 3.00 p.m\n"); case '5': printf("Departure Time: 5.00 p.m\n"); default: printf("Please enter the correct selection\n\n"); for(d=0;d<25;d++) { if(cust_Seat>25 || cust_Seat<0) printf("Invalid Seat Number"); if(cust_Seat>0 || cust_Seat<25) seat[cust_TicketClass][cust_Destination][cust_Time][cust_Seat]=1; } } } } } } void menu_chooseTicket() { printf("Please choose your Tciket Class\n\n"); printf("1 >> Business Class\n\n"); printf("2 >> Economy Class\n\n"); printf("Please enter your selection --> "); fflush(stdin); scanf("%d",&cust_TicketClass); } void menu_ChooseDestination() { printf("Please choose destination\n\n"); printf("1 >> Kuala Lumpur --> Langkawi\n\n"); printf("2 >> Langkawi --> Kuala Lumpur\n\n"); printf("Please enter your selection --> "); fflush(stdin); scanf("%d",&cust_Destination); } void menu_ChooseTime() { printf("Please choose flight time\n\n"); printf("1 >> 9 a.m.\n\n"); printf("2 >> 11 a.m.\n\n"); printf("3 >> 1 p.m.\n\n"); printf("4 >> 3 p.m.\n\n"); printf("5 >> 5 p.m.\n\n"); printf("Please enter your selection --> "); fflush(stdin); scanf("%d",&cust_Time); } void menu_ChooseSeat() { printf("Please choose your seat --> "); scanf("%d",&cust_Seat); } void menu_BizClass() { printf("Destination Menu\n"); printf("A --> Kuala Lumpur to Langkawi\n"); printf("B --> Langkawi to Kuala Lumpur\n"); printf("M --> Return to Main Menu\n"); printf("Please Enter your Selection -->"); fflush(stdin); BizClassSelect = getchar(); switch(BizClassSelect) { case 'a': case 'A': menu_DepartureBizKL(); break; case 'b': case 'B': menu_DepartureBizLK(); break; case 'M': case 'm': mainmenu(); break; default: printf("Please enter the correct selection"); menu_BizClass(); } } void menu_EconomyClass() { printf("Destination Menu\n"); printf("A --> Kuala Lumpur to Langkawi\n"); printf("B --> Langkawi to Kuala Lumpur\n"); printf("M --> Return to Main Menu\n"); printf("Please Enter your Selection -->"); fflush(stdin); EconomyClassSelect = getchar(); switch(EconomyClassSelect) { case 'a': case 'A': menu_DepartureEconKL(); break; case 'b': case 'B': menu_DepartureEconLK(); break; case 'M': case 'm': mainmenu(); break; default: printf("Please enter the correct selection"); menu_EconomyClass(); } } void menu_DepartureBizKL() { printf("Business Class\n"); printf("Departure Menu\n"); printf("Destination: Kuala Lumpur --> Langkawi\n"); printf("A --> 9.00 a.m\n"); printf("B --> 11.00 a.m\n"); printf("C --> 1.00 p.m\n"); printf("D --> 3.00 p.m\n"); printf("E --> 5.00 p.m\n"); printf("Please enter your selection --> "); } void menu_DepartureBizLK() { printf("Business Class\n"); printf("Departure Menu\n"); printf("Destination: Langkawi --> Kuala Lumpur\n"); printf("A --> 9.00 a.m\n"); printf("B --> 11.00 a.m\n"); printf("C --> 1.00 p.m\n"); printf("D --> 3.00 p.m\n"); printf("E --> 5.00 p.m\n"); printf("Please enter your selection --> "); } void menu_DepartureEconKL() { printf("Economy Class\n"); printf("Departure Menu\n"); printf("Destination: Kuala Lumpur --> Langkawi\n"); printf("A --> 9.00 a.m\n"); printf("B --> 11.00 a.m\n"); printf("C --> 1.00 p.m\n"); printf("D --> 3.00 p.m\n"); printf("E --> 5.00 p.m\n"); printf("Please enter your selection --> "); } void menu_DepartureEconLK() { printf("Economy Class\n"); printf("Departure Menu\n"); printf("Destination: Langkawi --> Kuala Lumpur\n"); printf("A --> 9.00 a.m\n"); printf("B --> 11.00 a.m\n"); printf("C --> 1.00 p.m\n"); printf("D --> 3.00 p.m\n"); printf("E --> 5.00 p.m\n"); printf("Please enter your selection --> "); } void menu_ViewSeating() { int row,col; int seats[5][5]={0}; printf("\t\tSeating In All Flights\n\n"); printf("\t1\t2\t3\t4\t5\n"); for (row=0; row<5; row++) { printf("\n%d", row+1); for (col=0; col<5; col++) { printf("\t%d", seats[row][col]); } } printf("\n\nBusiness Class Seats: 11,12,13,14,15\n\n"); printf("\n\nEconomy Class Seats: Other than the above\n\n"); }
)to book
2)to cancel
3)view data
4)quit
so when the user press 1 it should go for booking when it go for booking the it should allow the user to choose destination from four destination and the charge of every destination should be written then they should choose if it is one way or 2 ways then choose the day time and then choose how many passenger and how many of them are adult children infant then allow them to enter them name age passport number and then display the charge for the tickets if there is any adult then 100% of the charge children 60% and infant 10%.but if the user entered 2 then it should go for cancellation so the user after he enter his passport number should be allowed to cancel his booking with a full charge back but if the cancellation were at the same time then only 60% of the charge and for view data after the user enter his passport number they should display the whole data of the booking. i have no idea how to do this and the teacher didnt tell us how to do it he want us to read and learn so plz ireally need ur help
Last edited by gwendolyne; 11-15-2010 at 11:50 AM.
And no code tags! Thanks for making that highly unreadable. Please, for the love of all things good and holy, read the forum policies, entitled "Read before posting": C Board - Announcements in Forum : C Programming. Pretty much every forum has a "sticky" post like this, at the top of the forum, and following the rules will ensure you get the help you need.
Now, edit your post to use code tags, and make sure your code is properly formatted/indented. Then you might find us a bit more sympathetic to your needs.
sorry i dint no that i have to tag the codes
No, you did NONE of it, liar!c i did some of it :
What did claudiu say about SMS talk in post #5?
Those are the two longest run-on sentences I have ever seen, and not a speck of punctuation or capitalization. Read up on how to ask questions the smart way. There is a link to it on the "Read before posting" page I linked to in my previous post (#7).so when the user press 1 it should go for booking when it go for booking the it should allow the user to choose destination from four destination and the charge of every destination should be written then they should choose if it is one way or 2 ways then choose the day time and then choose how many passenger and how many of them are adult children infant then allow them to enter them name age passport number and then display the charge for the tickets if there is any adult then 100% of the charge children 60% and infant 10%.but if the user entered 2 then it should go for cancellation so the user after he enter his passport number should be allowed to cancel his booking with a full charge back but if the cancellation were at the same time then only 60% of the charge and for view data after the user enter his passport number they should display the whole data of the booking.
So why aren't you reading and learning?i have no idea how to do this and the teacher didnt tell us how to do it he want us to read and learn so
Are you sure you wrote the program you posted? This doesn't match the menu your code produces. You use letters, and don't have a "cancel" option.)to book
2)to cancel
3)view data
4)quit
I don't think anybody wants to help you plagiarize and cheat your way though a course.
1. Get rid of gets(). Never ever ever use it again. Replace it with fgets() and use that instead.
2. Get rid of void main and replace it with int main(void) and return 0 at the end of the function.
3. Get rid of conio.h and other antiquated DOS crap headers.
4. Don't cast the return value of malloc, even if you always always always make sure that stdlib.h is included.
As I demonstrated in my link, the OP did NOT write the code, it was found.Are you sure you wrote the program you posted? This doesn't match the menu your code produces. You use letters, and don't have a "cancel" option.
I figured as much![]()