Advertisement
Guest User

Untitled

a guest
Dec 11th, 2019
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.54 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main(){
  5.  
  6. //Declaring an array size variable that are storing seat_number,passenger_name,ticket_price,return_money,location & passenger phone number in 8 passenger
  7. char seat_number[8][10];// store seat number & d is a variable that compare two seat number .which is same or not
  8. char passenger_name[8][10];//store passenger name
  9. char location[8][10];//store location
  10. char bus_seat[8][3]={"A1","A2","A3","A4","B1","B2","B3","B4"};;//bus seat list
  11. float ticket_price[8];//counter is a loop control variable
  12. float return_money[8];//store return money
  13. int passenger_cell_num[8];//this variable collect 8 passenger call number and stored
  14. int counter,counter1;//counter1,counter is a loop control variable
  15. int compeare;// compare two seat number .which is same or not
  16.  
  17. printf( " WELCOME TO THA ENA COUNTER \n\n ");
  18. //print seat least in ENA bus
  19. printf("<<THE LEAST OF BUS SEAT IS HERE>> \n\n ");
  20. for(counter=0;counter<8;counter++){//This loop help to print bus seat lest
  21. printf(" %s ",bus_seat[counter]);//print that,which seat is already booked
  22. if((counter+1)%4==0){// This condition maintaining ,when number of 4 seat is print then print \n
  23. printf("\n ");
  24. }
  25. }
  26. for(counter=0;counter<8;counter++){
  27.  
  28. printf("\n\n\n---------------PASSENGER NO %d------------------------------\n\n ",counter+1);
  29. for(counter1=0;counter1<counter;counter1++){//This loop help to print already booked seat number
  30. printf("ALREADY BOOKING LIST IS HERE . \n ");
  31. printf("%s ",seat_number[counter1]);
  32. if((counter1+1)%4==0){// This condition maintaining ,when number of 4 seat is print then print \n
  33. printf("\n");
  34. }
  35. printf(" \nPlace select another seat \n\n");
  36. }
  37. printf("\n....................\n");
  38. //Input passenger name .
  39. printf("Place write your name : ");//passenger name like as(DEDAR,RIFAT)
  40. scanf("%s",&passenger_name[counter]);
  41. //Input location .where you drop
  42. printf("place enter your location : ");
  43. scanf("%s",&location[counter]);
  44. // input passenger mobile number
  45. printf("Place enter your phone number :");
  46. scanf("%d",&passenger_cell_num[counter]);
  47. // Input seat number ..
  48. printf("enter seat number : ");// seat number .. like as ,(A1,A2,B1,B2)
  49. scanf("%s",&seat_number[counter]);
  50. for(counter1=0;counter1<counter;counter1++){
  51. //Check this seat is already booked or not
  52. compeare=strcmp(seat_number[counter1],seat_number[counter]);
  53. if(compeare==0){
  54. printf("THIS SEAT IS ALREADY BOOKED .....PLACE ANOTHER CHOSE ...\n");
  55. printf("enter seat number : ");
  56. scanf("%s",&seat_number[counter]);//if this seat is already booked then input another chose .
  57. }
  58. }
  59. //place input your ticket money
  60. printf("Place pay your ticket price : ");
  61. scanf("%f",&ticket_price[counter]);
  62. //check this ticket_price .which is more then (500) or not ... The ticket price is 500 TK
  63. if(ticket_price[counter]<500){
  64. printf("This amount is not sufficient ,Place enter 500 TK or more then 500 TK : \n");
  65. printf("Place pay your ticket price : ");
  66. scanf("%f",&ticket_price[counter]);// If the amount is not sufficient .. then passenger input fixed ticket price again .
  67. }
  68.  
  69.  
  70. return_money[counter]=ticket_price[counter]-500;//if the passenger pay more then ticket price ,,it will be back this money
  71. //print the ticket .
  72. printf("\n_____________________________________________________________\n");
  73. printf("|TICKET| &&& HAPPY JOURNY IN ENA &&&\n");
  74. printf("| DHAKA TO MYMENSINGH \n");
  75. printf("| 4/6,mohakhali buss stand,tejgaon dhaka\n");
  76. printf("| Phone No: 34-2196; Cell: 01521508574\n|\n");
  77. printf("| PASSENGER NAME : %s \n", passenger_name[counter]);
  78. printf("| SEAT NUMBER : %s \n",seat_number[counter]);
  79. printf("| TICKET PRICE : 500/- TK You will Return : %.2f/- TK \n", return_money[counter]);
  80. printf("|______________________________________________________________\n\n");
  81.  
  82. }
  83.  
  84. printf("\n BOOKING LIST ");
  85. printf("\n..........................................................................\n");
  86. //Printing all the passenger name ,they were seat number and ticket price in 8 passenger
  87. for(counter=0;counter<8;counter++){
  88. printf("PASSENGER NAME : %s \n",passenger_name[counter]);// print passenger name
  89. printf("location : %s \n",location[counter]);//location of passenger
  90. printf("seat_number : %s \n",seat_number[counter]);// print seat number
  91. printf("Passenger mobile number :%d\n",passenger_cell_num[counter]);//print passenger phone number
  92. printf("ticket price : 500/- TK passenger_return : %.2f TK/-\n\n",return_money[counter]);//return money
  93. printf("\n");
  94. }
  95. printf("\n\n-------------------------------------------------\n");
  96. printf("TOTAL TICKET PRICE IN ALL THE PASSENGER : %.2f/- TK",counter*500);//total money all the passenger
  97. printf("\n\n-------------------------------------------------\n");
  98.  
  99. printf("...........................................................................\n");
  100.  
  101. return 0;
  102. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement