Guest User

Untitled

a guest
Jan 16th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.95 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3.  
  4. int a, b, c, d, e, f,sf=0,ff=0;
  5. int i,c,s=-1,g=1;
  6. int temp,admin=4321,user=1234;
  7. struct node
  8. {
  9. int id;
  10. char name[50];
  11. int mobile_number[20];
  12. int seat_fee;
  13. int food_fee;
  14. int total;
  15. struct node *next;
  16. }*start,*head,*tail;
  17.  
  18. int main()
  19. {
  20. welcome();
  21. main_menu();
  22. }
  23. welcome()
  24. {
  25. printf("\t\t*************************************\n");
  26. printf("\t\t*************************************\n");
  27. printf("\t\t*************************************\n");
  28. printf("\t\t********** Welcome **********\n");
  29. printf("\t\t********** To **********\n");
  30. printf("\t\t********** Daffodil Hostel **********\n");
  31. printf("\t\t*************************************\n");
  32. printf("\t\t*************************************\n");
  33. printf("\t\t*************************************\n");
  34. }
  35. main_menu()
  36. {
  37. printf("\n\n\t\t*********************************************\n");
  38. printf("\t\t*** press 1 for Administrator ***\n");
  39. printf("\t\t*** press 2 for User ***\n");
  40. printf("\t\t*** press 3 for Visitor ***\n");
  41. printf("\t\t*********************************************\n\n\n");
  42. printf("Enter your Choice:");
  43.  
  44. scanf("%d",&a);
  45. if(a == 1)
  46. {
  47. printf("Welcome Administrator\n");
  48. Administrator();
  49. }
  50. else if(a == 2)
  51. {
  52. printf("Welcome User\n");
  53. reg_user();
  54. }
  55. else if(a == 3)
  56. {
  57. printf("Welcome visitor\n");
  58. visitor();
  59. }
  60. else
  61. {
  62. printf("Invalid Input\n");
  63. printf("Try again\n");
  64. main_menu();
  65. }
  66. }
  67.  
  68. Administrator()
  69. {
  70. printf("Enter Password for log in:\n");
  71. printf("or\n");
  72. printf("Press 0 for Main Menu\n");
  73. printf("Enter your Choice:");
  74. scanf("%d",&temp);
  75. if(temp == admin)
  76. {
  77. admin_interface();
  78. }
  79. else if(temp == 0)
  80. {
  81. main_menu();
  82. }
  83. else
  84. {
  85. printf("Invalid Input\n");
  86. printf("Try again\n");
  87. Administrator();
  88. }
  89. }
  90.  
  91. admin_interface()
  92. {
  93. printf("\n\n\t\t===========================================\n");
  94. printf("\t\t| Press 1 for student information |\n");
  95. printf("\t\t| Press 2 for Account |\n");
  96. printf("\t\t| Press 3 for Employee |\n");
  97. printf("\t\t| Press 0 for Main Menu |\n");
  98. printf("\t\t===========================================\n\n");
  99. printf("Enter your Choice: ");
  100. scanf("%d",&temp);
  101. if(temp == 1)
  102. {
  103.  
  104. student_info();
  105. printf("\n\n");
  106. admin_interface();
  107. }
  108. else if(temp == 2)
  109. {
  110. printf("\t\t\t**************************************");
  111. printf("\n\t\t\t* Total Seat fee : %d *\n", sf);
  112. printf("\t\t\t---------------------------------------\n");
  113. printf("\n\t\t\t* Total Food fee : %d *\n", ff);
  114. printf("\t\t\t---------------------------------------\n");
  115. printf("\n\t\t\t* Total amount is: %d *\n", sf+ff);
  116. printf("\t\t\t**************************************");
  117. printf("\n\n");
  118. admin_interface();
  119.  
  120. }
  121. else if(temp == 3)
  122. {
  123. printf("\n\n\t||** Hostel in charge **||** Cooker **||** Gate keeper **||\n");
  124. printf("\t------------------------------------------------------------------\n");
  125. printf("\t|| Tapasy Rabeya || Fatema banu || Jolil Mia ||\n");
  126. printf("\t|| Sanjida Ferdaus || Bilkis banu || Mamun Mia ||\n");
  127. printf("\t|| Aklima Akter || Sokina Banu || Saiful hasan ||\n");
  128. printf("\t------------------------------------------------------------------\n");
  129. printf("\n\n");
  130. admin_interface();
  131. }
  132. else if(temp == 0)
  133. {
  134. main_menu();
  135. printf("\n\n");
  136. }
  137. else
  138. {
  139. printf("Invalid Input\n");
  140. admin_interface();
  141. }
  142. }
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152. student_info()
  153. {
  154. printf("\n\n\t\t\tTotal number of Student is:%d",s);
  155. head=start->next;
  156. while(head!=NULL)
  157. {
  158. printf("\n\n %d\n %s\n %d\n %d\n %d\n\n ",head->id,head->name,head->mobile_number,head->seat_fee,head->food_fee);
  159. head=head->next;
  160. }
  161. }
  162.  
  163.  
  164.  
  165.  
  166. user_interface()
  167. {
  168. printf("\n\n\t\t\t\tEnter Password for log in:\n");
  169. printf("\t\t\t\tor\n");
  170. printf("\t\t\t\tPress 0 for Main Menu\n\n");
  171. printf("Enter your Choice:");
  172. scanf("%d",&temp);
  173. if(temp == user)
  174. {
  175. reg_user();
  176. }
  177. else if(temp == 0)
  178. {
  179. main_menu();
  180. }
  181. else
  182. {
  183. printf("Invalid Input\n");
  184. printf("Try again\n");
  185. user_interface();
  186. }
  187. }
  188.  
  189. reg_user(){
  190. printf("\n\n\t\t\t**********************************************\n");
  191. printf("\t\t\t*** press 1 for own information ***\n");
  192. printf("\t\t\t*** press 2 for hostel rule regulation ***\n");
  193. printf("\t\t\t*** press 3 for food menu ***\n");
  194. printf("\t\t\t*** press 4 for main menu ***\n");
  195. printf("\t\t\t**********************************************\n");
  196. printf("\n\nEnter your choice: ");
  197. scanf("%d",&i);
  198. if(i==1){
  199. search();
  200. printf("\n\n");
  201. reg_user();
  202.  
  203. }
  204. else if(i==2){
  205. rulls();
  206. printf("\n\n");
  207. reg_user();
  208. }
  209. else if(i==3){
  210. food_menu();
  211. printf("\n\n");
  212. reg_user();
  213. }
  214. else if(i==4){
  215. main_menu();
  216. printf("\n\n");
  217. }
  218. else
  219. {
  220. printf("Invalid Input\n");
  221. printf("Try again\n");
  222. reg_user();
  223. }
  224.  
  225. }
  226.  
  227. search(){
  228. int n;
  229. head=start;
  230. printf("\n\n\t\t\t**********************************************\n");
  231. printf("\t\t\t*** Enter Your ID or press 0 for back ***\n");
  232. printf("\t\t\t**********************************************\n");
  233. printf("\n\nEnter Your ID : ");
  234. scanf("%d",&n);
  235.  
  236. while (head->next!=NULL)
  237. {
  238. if (head->id==n)
  239. {
  240. printf("\t\t-------------------------------------\n");
  241. printf("\t\t* ID : %d\n",head->id);
  242. printf("\t\t-------------------------------------\n");
  243. printf("\t\t* Name : %s\n",head->name);
  244. printf("\t\t-------------------------------------\n");
  245. printf("\t\t* Mobile no : 01%d\n",head->mobile_number);
  246. printf("\t\t-------------------------------------\n");
  247. printf("\t\t* Seat fee : %d\n",head->seat_fee);
  248. printf("\t\t-------------------------------------\n");
  249. printf("\t\t* Food fee : %d\n",head->food_fee);
  250. printf("\t\t-------------------------------------\n");
  251. return 0;
  252. }
  253. head=head->next;
  254. }
  255. if(n==0)
  256. {
  257. reg_user();
  258. }
  259. else
  260. {
  261. printf("\n\n\t\t\tYour ID is Not Match :%d\n\t\t\t\tTRY AGAIN\n)",n);
  262. return search ();
  263. }
  264. }
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271.  
  272.  
  273. visitor()
  274. {
  275. printf("press 1 for Hostel 1\n");
  276. printf("press 2 for Hostel 2\n");
  277. printf("press 3 for Hostel 3\n");
  278. printf("press 4 for Hostel 4\n");
  279. printf("press 5 for Hostel 5\n");
  280. printf("press 6 for Hostel 6\n");
  281. printf("press 7 for Sort by Distance\n");
  282. printf("press 8 for Sort by Cost\n");
  283. printf("press 9 for Sort by Quality\n");
  284. printf("press 11 Hostel Rules\n");
  285. printf("press 11 special_service\n");
  286. printf("Press 0 for Main Menu\n");
  287. printf("Enter your Choice:");
  288.  
  289. scanf("%d",&b);
  290. if(b==1)
  291. {
  292. hostel_1();
  293. }
  294. else if(b==2)
  295. {
  296. hostel_2();
  297. }
  298. else if(b==3)
  299. {
  300. hostel_3();
  301. }
  302. else if(b==4)
  303. {
  304. hostel_4();
  305. }
  306. else if(b==5)
  307. {
  308. hostel_5();
  309. }
  310. else if(b==6)
  311. {
  312. hostel_6();
  313. }
  314. else if(b==7)
  315. {
  316. hostel_1();
  317. }
  318. else if(b==8)
  319. {
  320. hostel_1();
  321. }
  322. else if(b==9)
  323. {
  324. hostel_1();
  325. }
  326. else if(b==10)
  327. {
  328. rulls();
  329. }
  330. else if(b==11)
  331. {
  332. special_service();
  333. }
  334. else
  335. {
  336. printf("Invalid Input\n");
  337. printf("Try again\n");
  338. visitor();
  339. }
  340. }
  341.  
  342.  
  343.  
  344. hostel_1()
  345. {
  346. printf("welcome to Hostel 1\n");
  347. printf("Cost 5000\n");
  348. printf("Distance 5KM\n");
  349. printf("Quality Good\n");
  350. printf("Press 1 for registration\n");
  351. printf("Press 2 for Back\n");
  352. printf("Press 0 for Main Menu\n");
  353. printf("Enter your Choice:");
  354. scanf("%d",&temp);
  355. if(temp==1)
  356. {
  357. registration();
  358. }
  359. else if(temp==2)
  360. {
  361. visitor();
  362. }
  363. else if(temp==0)
  364. {
  365. main_menu();
  366. }
  367. else
  368. {
  369. printf("Invalid Input\n");
  370. printf("Try again\n");
  371. hostel_1();
  372. }
  373. }
  374. hostel_2()
  375. {
  376. printf("welcome to Hostel 2\n");
  377. printf("welcome to Hostel 1\n");
  378. printf("Cost 5000\n");
  379. printf("Distance 5KM\n");
  380. printf("Quality Good\n");
  381. printf("Press 1 for registration\n");
  382. printf("Press 2 for Back\n");
  383. printf("Press 0 for Main Menu\n");
  384. printf("Enter your Choice:");
  385. scanf("%d",&temp);
  386. if(temp==1)
  387. {
  388. registration();
  389. }
  390. else if(temp==2)
  391. {
  392. visitor();
  393. }
  394. else if(temp==0)
  395. {
  396. main_menu();
  397. }
  398. else
  399. {
  400. printf("Invalid Input\n");
  401. printf("Try again\n");
  402. hostel_2();
  403. }
  404. }
  405. hostel_3()
  406. {
  407. printf("welcome to Hostel 3\n");
  408. printf("welcome to Hostel 1\n");
  409. printf("Cost 5000\n");
  410. printf("Distance 5KM\n");
  411. printf("Quality Good\n");
  412. printf("Press 1 for registration\n");
  413. printf("Press 2 for Back\n");
  414. printf("Press 0 for Main Menu\n");
  415. printf("Enter your Choice:");
  416. scanf("%d",&temp);
  417. if(temp==1)
  418. {
  419. registration();
  420. }
  421. else if(temp==2)
  422. {
  423. visitor();
  424. }
  425. else if(temp==0)
  426. {
  427. main_menu();
  428. }
  429. else
  430. {
  431. printf("Invalid Input\n");
  432. printf("Try again\n");
  433. hostel_3();
  434. }
  435. }
  436. hostel_4()
  437. {
  438. printf("welcome to Hostel 4\n");
  439. printf("welcome to Hostel 1\n");
  440. printf("Cost 5000\n");
  441. printf("Distance 5KM\n");
  442. printf("Quality Good\n");
  443. printf("Press 1 for registration\n");
  444. printf("Press 2 for Back\n");
  445. printf("Press 0 for Main Menu\n");
  446. printf("Enter your Choice:");
  447. scanf("%d",&temp);
  448. if(temp==1)
  449. {
  450. registration();
  451. }
  452. else if(temp==2)
  453. {
  454. visitor();
  455. }
  456. else if(temp==0)
  457. {
  458. main_menu();
  459. }
  460. else
  461. {
  462. printf("Invalid Input\n");
  463. printf("Try again\n");
  464. hostel_4();
  465. }
  466. }
  467. hostel_5()
  468. {
  469. printf("welcome to Hostel 5\n");
  470. printf("welcome to Hostel 1\n");
  471. printf("Cost 5000\n");
  472. printf("Distance 5KM\n");
  473. printf("Quality Good\n");
  474. printf("Press 1 for registration\n");
  475. printf("Press 2 for Back\n");
  476. printf("Press 0 for Main Menu\n");
  477. printf("Enter your Choice:");
  478. scanf("%d",&temp);
  479. if(temp==1)
  480. {
  481. registration();
  482. }
  483. else if(temp==2)
  484. {
  485. visitor();
  486. }
  487. else if(temp==0)
  488. {
  489. main_menu();
  490. }
  491. else
  492. {
  493. printf("Invalid Input\n");
  494. printf("Try again\n");
  495. hostel_5();
  496. }
  497. }
  498. hostel_6()
  499. {
  500. printf("welcome to Hostel 6\n");
  501. printf("welcome to Hostel 1\n");
  502. printf("Cost 5000\n");
  503. printf("Distance 5KM\n");
  504. printf("Quality Good\n");
  505. printf("Press 1 for registration\n");
  506. printf("Press 2 for Back\n");
  507. printf("Press 0 for Main Menu\n");
  508. printf("Enter your Choice:");
  509. scanf("%d",&temp);
  510. if(temp==1)
  511. {
  512. registration();
  513. }
  514. else if(temp==2)
  515. {
  516. visitor();
  517. }
  518. else if(temp==0)
  519. {
  520. main_menu();
  521. }
  522. else
  523. {
  524. printf("Invalid Input\n");
  525. printf("Try again\n");
  526. hostel_6();
  527. }
  528. }
  529.  
  530.  
  531.  
  532. registration()
  533. {
  534. printf(" \n\n\t\t\t:-) ;-) Create your Account !!!!\n\n");
  535. printf(" \n\n\t\t\t:-) ;-) Create your Account !!!!\n\n");
  536. printf(" \n\n\t\t\t:-) ;-) Create your Account !!!!\n\n");
  537. printf("\n\n");
  538. if(g==1)
  539. {
  540. start=(struct node*)malloc(sizeof(struct node));
  541. printf("Enter the id: ");
  542. scanf("%d",&start->id);
  543. printf("Enter your name: ");
  544. scanf("%s",&start->name);
  545. printf("Enter your mobile number: ");
  546. scanf("%d",&start->mobile_number);
  547. printf("Enter seat fee: ");
  548. scanf("%d",&start->seat_fee);
  549. printf("Enter food fee: ");
  550. scanf("%d",&start->food_fee);
  551. start->next=NULL;
  552. head=start;
  553. }
  554. else
  555. {
  556. tail=(struct node*)malloc(sizeof(struct node));
  557. printf("Enter the id: ");
  558. scanf("%d",&tail->id);
  559. printf("Enter your name: ");
  560. scanf("%s",&tail->name);
  561. printf("Enter your mobile number: ");
  562. scanf("%d",&tail->mobile_number);
  563. printf("Enter seat fee: ");
  564. scanf("%d",&tail->seat_fee);
  565. printf("Enter food fee: ");
  566. scanf("%d",&tail->food_fee);
  567. tail->next=NULL;
  568. head->next=tail;
  569. head=tail;
  570. sf=sf+tail->seat_fee;
  571. ff=ff+tail->food_fee;
  572. }
  573. g=g+1;
  574. s=s+1;
  575. confirm();
  576. }
  577.  
  578. special_service()
  579. {
  580. printf("\n\n");
  581. printf("\t------------------------------------\n\t| Begume Kokaiya girls hostle two|\n\t------------------------------------ \n 1. single room with attached bathroom and balcony.\n 2. room service\n 3. cost : 5000tk only.\n\n");
  582. printf("\t------------------------------------\n\t| Begume Kokaiya girls hostle one |\n\t------------------------------------ \n 1. single room with attached bathroom and balcony.\n 2. cost : 4000tk only.\n\n");
  583. printf("\t------------------------------------\n\t| Begume Kokaiya girls hostle three|\n\t------------------------------------ \n 1. single room with attached bathroom and balcony.\n 2. cost : 4000tk only.\n\n");
  584. }
  585.  
  586.  
  587. rulls()
  588. {
  589. printf("\n\t1.you have to pay hostel charge every month within first 10 days.\n ");
  590. printf("\tafter 10 day you have to pay 20tk for each day & 200tk for each month.\n");
  591. printf("\t2.you have to back in hostel in due time. \n\t\t\tsummer: last time 7.00pm\n\t\t\twinter: last time 6.00pm \n");
  592. printf("\t3.before 6 month you cant leave the hostel.\n");
  593. printf("\t4.if you want to leave this hostel you have to inform the hostel \n\tauthority before 2 month.\n");
  594. printf("\t5.if you have computer or laptop, we have to pay 100tk as fee.\n");
  595. printf("\t6.only your two local guardian can come to meet with you\n");
  596. }
  597.  
  598.  
  599.  
  600. food_menu(){
  601. printf("\n\n");
  602. printf("| Day | Breakfast | lunch | Dinner |\n");
  603. printf("=============================================================================\n");
  604. printf("| sat | ruti,vegetable | rice,chicken,lentil | rice,vegetable,vorta,lentil|\n");
  605. printf("-----------------------------------------------------------------------------\n");
  606. printf("| sun | rice, vegetable | rice,fish,lentil | rice,vegetable,egg,lentil |\n");
  607. printf("-----------------------------------------------------------------------------\n");
  608. printf("| mon | ruti,egg | rice,chicken,lentil | rice,fish,lentil |\n");
  609. printf("-----------------------------------------------------------------------------\n");
  610. printf("| tue | khichuri,egg | rice,meat,lentil | rice,fish,lentil |\n");
  611. printf("-----------------------------------------------------------------------------\n");
  612. printf("| wed | rice, vorta | rice,chicken,lentil | rice,egg,lentil |\n");
  613. printf("-----------------------------------------------------------------------------\n");
  614. printf("| thu | ruti, vegetable | rice,fish,lentil | rice,vegetable,egg,lentil |\n");
  615. printf("-----------------------------------------------------------------------------\n");
  616. printf("| fri | khichuri,egg | rice,chicken,lentil | rice,fish,lentil |\n");
  617. printf("=============================================================================\n");
  618. }
  619.  
  620. confirm()
  621. {
  622. printf(" \n\n\t\t\t:-) ;-) Congratulation !!!!\n\n");
  623. printf(" \n\n\t\t\t:-) ;-) Your Account is Create !!!!\n\n");
  624. printf("\t\t You become a member of our Hostel.\n");
  625. main_menu();
  626. }
Add Comment
Please, Sign In to add comment