fork download
  1. // C program to implement
  2. // the above approach
  3.  
  4.  
  5. #include <stdio.h>
  6. #include <stdlib.h>
  7. #include <string.h>
  8.  
  9. // Defining Structure
  10. typedef struct mynode {
  11. char name[20];
  12. char gen[6];
  13. int age;
  14. struct mynode* link;
  15. } Node;
  16. Node* start = NULL;
  17.  
  18. // Declaring Function Used
  19. // In This Program
  20. void heading();
  21. void details();
  22. void inter();
  23. void india();
  24. void receipt();
  25.  
  26. // Global variables
  27. int k, amount;
  28. char type[60], place[30], date[20];
  29.  
  30. // Driver Code
  31. void main()
  32. {
  33. int a;
  34.  
  35. // Calling heading() function
  36. heading();
  37.  
  38. // Taking Choice From User
  39. printf("\t\t\t\t1. International "
  40. "Tour Packages\n");
  41. printf("\t\t\t\t2. India Tour Packages\n");
  42. printf("\t\t\t\tEnter Choice: ");
  43. scanf("%d", &a);
  44. switch (a) {
  45. // Calling inter() function
  46. case 1:
  47. inter();
  48. break;
  49.  
  50. // Calling india() function
  51. case 2:
  52. india();
  53. break;
  54.  
  55. default:
  56. printf("Enter Right Choice...");
  57. break;
  58. }
  59.  
  60. // Calling details() function
  61. details();
  62.  
  63. // Calling receipt() function
  64. receipt();
  65. }
  66.  
  67. // Function To Take Package
  68. // Choice From India
  69. void india()
  70. {
  71. int a;
  72.  
  73. // Clearing Screen
  74. system("cls");
  75.  
  76. // Calling heading() function
  77. heading();
  78. strcpy(type, "India Tour Package");
  79. printf("\t\t\t\t1. Shimla Tour Packages "
  80. "6 Days 7 Nights (18880/-)\n");
  81. printf("\t\t\t\t2. Kashmir Tour Packages "
  82. "5 Days 4 Nights (35500/-)\n");
  83. printf("\t\t\t\t3. Kolkata Tour Packages "
  84. "11 Days 10 Nights (10000/-)\n");
  85. printf("\t\t\t\tEnter Choice: ");
  86. scanf("%d", &a);
  87. if (a == 1) {
  88. strcpy(place, "Shimla Tour");
  89. amount = 18880;
  90. }
  91. else if (a == 2) {
  92. strcpy(place, "Kashmir Tour");
  93. amount = 35500;
  94. }
  95. else if (a == 3) {
  96. strcpy(place, "Kolkata Tour");
  97. amount = 10000;
  98. }
  99. else
  100. printf("Enter Correct Choice...");
  101. }
  102.  
  103. // Function To Take Package Choice
  104. // From International
  105. void inter()
  106. {
  107. int a;
  108.  
  109. // Clearing Screen
  110. system("cls");
  111.  
  112. // Calling heading() function
  113. heading();
  114. strcpy(type, "International Tour Package");
  115. printf("\t\t\t\t1. England Tour Packages "
  116. "6 Days 7 Nights (28880/-)\n");
  117. printf("\t\t\t\t2. Thailand Tour Packages "
  118. "5 Days 4 Nights (15500/-)\n");
  119. printf("\t\t\t\t3. New York Tour Packages "
  120. "11 Days 10 Nights (567800/-)\n");
  121. printf("\t\t\t\tEnter Choice: ");
  122. scanf("%d", &a);
  123. if (a == 1) {
  124. strcpy(place, "England Tour");
  125. amount = 28880;
  126. }
  127. else if (a == 2) {
  128. strcpy(place, "Thailand Tour");
  129. amount = 15500;
  130. }
  131. else if (a == 3) {
  132. strcpy(place, "New York Tour");
  133. amount = 567800;
  134. }
  135. else
  136. printf("Enter Correct Choice...");
  137. }
  138.  
  139. // Function To Take Passenger Details
  140. void details()
  141. {
  142. int i, a;
  143. char val[20], gen[6];
  144.  
  145. // Clearing Screen
  146. system("cls");
  147.  
  148. // Calling heading() function
  149. heading();
  150. printf("\t\t\t\tEnter Number Of "
  151. "Passengers: ");
  152. scanf("%d", &k);
  153. printf("\t\t\t\tEnter Date "
  154. "(DD/MM/YY): ");
  155. fflush(stdin);
  156. gets(date);
  157. for (i = 1; i <= k; i++) {
  158. system("cls");
  159. heading();
  160. printf("\t\t\t\tEnter The %dth "
  161. "Passenger Name: ",
  162. i);
  163. fflush(stdin);
  164. gets(val);
  165. printf("\t\t\t\tEnter The %dth "
  166. "Passenger Gender: ",
  167. i);
  168. fflush(stdin);
  169. gets(gen);
  170. printf("\t\t\t\tEnter The %dth "
  171. "Passenger Age: ",
  172. i);
  173. fflush(stdin);
  174. scanf("%d", &a);
  175.  
  176. // Calling add_node() function
  177. add_node(val, gen, a);
  178. }
  179. }
  180.  
  181. // Function to add details in
  182. // node for each passengers
  183. void add_node(char lol[20],
  184. char der[6], int b)
  185. {
  186. Node *newptr = NULL, *ptr;
  187. newptr = (Node*)malloc(sizeof(Node));
  188. strcpy(newptr->name, lol);
  189. strcpy(newptr->gen, der);
  190. newptr->age = b;
  191. newptr->link = NULL;
  192. if (start == NULL)
  193. start = newptr;
  194. else {
  195. ptr = start;
  196. while (ptr->link != NULL)
  197. ptr = ptr->link;
  198. ptr->link = newptr;
  199. }
  200. }
  201.  
  202. // Function For Printing Receipt
  203. void receipt()
  204. {
  205. int i, b;
  206. Node* ptr = start;
  207. system("cls");
  208. heading();
  209. printf("\n\t\t\t\t**Take Screenshot "
  210. "For Further Use**\n");
  211. for (i = 1; i <= k; i++) {
  212. printf("\t\t\t\t%dst Passenger "
  213. "Name: ",
  214. i);
  215. puts(ptr->name);
  216. printf("\t\t\t\t%dst Passenger "
  217. "Gender: ",
  218. i);
  219. puts(ptr->gen);
  220. printf("\t\t\t\t%dst Passenger "
  221. "Age: %d\n\n",
  222. i, ptr->age);
  223. ptr = ptr->link;
  224. }
  225. printf("\t\t\t\tSelected Type: ");
  226. puts(type);
  227. printf("\t\t\t\tPackage: ");
  228. puts(place);
  229. printf("\t\t\t\tDate: ");
  230. puts(date);
  231. b = amount * k;
  232. printf("\t\t\t\tTotal Amount: %d", b);
  233. printf("\n\t\t\t\t**Thank You For "
  234. "registration**");
  235. }
  236.  
  237. // Function For Printing Heading
  238. // Of Portal
  239. void heading()
  240. {
  241. printf("\t\t\t\t***Tourism Package "
  242. "Management System***\n");
  243. printf("\t\t\t***Vaccination Certificate "
  244. "Is Necessary For Travel Purpose***\n\n");
  245. }
Success #stdin #stdout #stderr 0.01s 5296KB
stdin
Standard input is empty
stdout
				***Tourism Package Management System***
			***Vaccination Certificate Is Necessary For Travel Purpose***

				1. International Tour Packages
				2. India Tour Packages
				Enter Choice: Enter Right Choice...				***Tourism Package Management System***
			***Vaccination Certificate Is Necessary For Travel Purpose***

				Enter Number Of Passengers: 				Enter Date (DD/MM/YY): 				***Tourism Package Management System***
			***Vaccination Certificate Is Necessary For Travel Purpose***


				**Take Screenshot For Further Use**
				Selected Type: 
				Package: 
				Date: 
				Total Amount: 0
				**Thank You For registration**
stderr
sh: 1: cls: not found
sh: 1: cls: not found