fork download
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. // #include <conio.h>
  5. // #include <malloc.h>
  6. #include <fstream>
  7. using namespace std;
  8. int obn,ext,prnt_once=0,dir_customer=0;//to save the hall number
  9. //dir_customer=0 if the user directly goes to user instead of manager
  10. //prnt_once to print once the term user foun
  11. int m=0,*p,sn,arg,arg2,tkt,tkt_pr,nt=0,sti,foundu=0,foundp=0,pas_chk=0,mv_str=0,data_store=0;
  12. double cost=0;
  13. //data_store=0 TO STORE THAT THE DATA IS SUCCESSFULLY STORED IN FILE
  14. //mv_str=0 to run the loop when data is being brought from file to compiler
  15. int pas_rak=0;//to store the return value of function password_check()
  16. //sn is variable for show number in manager function N m is for number of shows in a day
  17. //pas_chk stores the value i.e password matched or not
  18. //foundu to storevalue if user exists
  19. //foundo to storevalue if password is correct
  20. char cus_in;
  21. //cus_in is for storing if customer is new or existing
  22. //sti is for showtime input in manager func
  23. //st is for showtime check the seat_disp func
  24. //tkt is to count the no.of tickets to be booked by customer
  25. //tkt_pr is to print the no.of tickets to be booked
  26. //nt is the number of timings of a particular movie
  27. string name[100],tkt_pnt,pass,cus_id,cus_pas,user,hall_name;//pass is to save the password
  28. //hall_name to store the hall name
  29. //cus_id for storing customer id
  30. //cus_pas is for storing customer password
  31. //tkt_pnt[100] to print the movie name in ticket
  32. int ar[100][100][100][12][18],tkt_row[12],tkt_col[18],str_tim[100];//last two array r to be used to print ticket
  33. //str_tim is saving the no.of show of a particular movie
  34. /*in the array ar
  35. 1st arg is for movie no.
  36. 2nd arg is for particular showtime of particular movie
  37. 3rd arg is for rows
  38. 4th arg is for columns*/
  39. string tim[100][100];
  40. /*ITS THE string array to store the timings of a particular movie
  41. 1st argument is for movie number and and argument is for no.timings that
  42. particular runs*/
  43. string timing[100];//to store various timings of movie in file
  44. class movie_booking
  45. {
  46.  
  47. public:
  48. void first();
  49. void show_seat_frm_file();
  50. void show();
  51. void seatdisp(int z,int wt);
  52. void book(int z,int wt ,int a);
  53. void seatin(int z,int wt);
  54. void manager();
  55. void ticket_print();
  56. void pass_proctect();
  57. void data_str();
  58. int password_check();
  59. void hal_name()
  60. {
  61. switch(obn)
  62. {
  63. case 1:
  64. hall_name="INOX BHUBANESWAR";
  65. break;
  66. case 2:
  67. hall_name="CINEPOLIS BHUBANESWAR";
  68. break;
  69. case 3:
  70. hall_name="KESHARI TALKIES";
  71. break;
  72. case 4:
  73. hall_name="MAHARAJA";
  74. break;
  75. }
  76.  
  77. }
  78.  
  79. };
  80.  
  81.  
  82. void movie_booking::first()
  83. {
  84. int i;
  85. char in='c',ind,cus;//cus is customer and ind is manager input
  86. cout<<"\n\n\t\t\t\t\tTO ENTER MANAGER LOGIN PRESS 'o' or 'O' ELSE ANY OTHER KEY FOR CUSTOMER BOOKING\n";
  87. cout<<"\t\t\t\t\t\t\t";
  88. cin>>ind;
  89. int pas_count=0;
  90. if((ind=='o')||(ind=='O'))
  91. {
  92. while(pas_count<3)
  93. {
  94. (*this).pass_proctect();
  95. if(pass=="KASAW")
  96. {
  97. (*this).manager();//the manager mode to set the number of seats available for booking
  98. pas_count=3;
  99. }
  100.  
  101. else
  102. {
  103. cout<<"PASSWORD ENTERED IS WRONG!!"<<" ATTEMPTS REMAINING = "<<2-pas_count<<" \n";//pas_count is to count no. of attempts left
  104. pas_count++;
  105. }
  106.  
  107. }
  108. }
  109.  
  110. system("clear");
  111. cout<<"\n\n\t\t\t\t\t\t\tDEAR CUSTOMER TO BOOK SEATS PRESS 'y' or 'Y' \n";
  112. cout<<"\t\t\t\t\t\t\t";
  113. cin>>cus;
  114. //HERE I HAVE TO ADD THE CUSTOMER LOGIN FUNCTION
  115. if((cus=='y')||(cus=='Y'))//the customer part starts here
  116. { cout<<"\n\t\t\t\t\t\t\tIF YOU ARE NEW CUSTOMER PRESS N/n TO SIGNUP\n";
  117. cout<<"\t\t\t\t\t\t\t";
  118. cin>>cus_in;
  119. if(cus_in=='N'||cus_in=='n')
  120. (*this).data_str();
  121. else
  122. {
  123. cout<<"\n\t\t\t\t\t\t\tWELCOME EXISTING CUSTOMER!!!\n";
  124. pas_rak=(*this).password_check();
  125.  
  126. }
  127.  
  128. //cout<<"+++++++++++"<<pas_rak<<"--------"<<data_store<<endl;to check the values
  129. cout<<"\t\t\t\t\t\t\t";
  130. cout<<"PRESS ANYKEY TO CONTINUE\n";
  131. // CLEAR();
  132. system("clear");
  133. if(pas_rak!=0||data_store!=0)
  134. { cout<<"\n\n\t\t\t\t\t\tTHE SEATS AVAILABLE ARE:\n";
  135. while((in=='c')||(in=='C'))
  136. {
  137. cost=0;
  138. (*this).show_seat_frm_file();
  139. cout<<"\n\n\t\t\t\t\t\t\tENTER THE MOVIE NUMBER TO BOOK TICKET\n";
  140. cout<<"\t\t\t\t\t\t\t";
  141. cin>>arg;
  142. ifstream fin;//this part is for retrieving moive name from file
  143. fin.open("movie_test2.csv");
  144. for(i=0;i<arg-1;i++)
  145. {
  146. getline(fin,name[i],'\n');
  147. }
  148. getline(fin,name[i],',');
  149. fin.close();
  150. cout<<"\n\n\t\t\t\t\t\t\tCHOOSE THE NUMBER CORRENSPONDING TO TIMING TO BOOK TICKET FOR MOVIE :-"<<endl;
  151.  
  152. cout<<"\t\t\t\t\t\t\t"<<name[i];
  153. cout<<"\t\t\t\t\t\t\t";
  154. cin>>sti;
  155.  
  156. tkt_pnt=name[i];
  157. // cout<<"THE ARGUMENT IS ="<<arg<<endl;
  158. (*this).seatdisp(arg,sti);
  159. (*this).seatin(arg,sti);
  160. system("clear");
  161. (*this).seatdisp(arg,sti);
  162. /*HERE ANOTHER FUNCTION IS TO BE WRITTEN TO PRINT THE TICKETS*/
  163. system("clear");
  164.  
  165. (*this).ticket_print();
  166. cout<<"\n\n\t\t\t\t\t\t\tPRESS 'C' or 'c' IF U WANT TO BOOK SEAT AGAIN?\n";
  167. cin>>in;
  168.  
  169.  
  170.  
  171. }
  172. }
  173.  
  174. else{cout<<"\n\n\t\t\t\t\t\t\t YOU PRESSED WRONG USER PASSWORD\n";
  175. cout<<"\n\n\t\t\t\t\t\t\t PROGRAM TERMINATED!!!\n";
  176. cout<<"\n\n\t\t\t\t\t\t\t YOU ENTERED WRONG PASSWORD";}
  177.  
  178. }
  179. }
  180.  
  181. void movie_booking::show_seat_frm_file()
  182. {int i=0,j;
  183. system("clear");//after the input is being over the screen is cleared and data is displayed
  184. cout<<"\n\n\t\t\t\t\t\t\tTHE MOVIES RUNNING IN HALL ARE:\n\n\n";
  185. ifstream fin;
  186. fin.open("movie_test2.csv");
  187. if(dir_customer==0)
  188. m=13;
  189. while(i<m)
  190. {
  191. cout<<"\n\t\t\t\t\t\t\t";
  192.  
  193. getline(fin,name[i],',');
  194. cout<<"MOVIE :\t"<<i+1<<"\t"<<name[i]<<endl<<endl;
  195. cout<<"\t\t\t\t\t\t\t";
  196. cout<<"THE TIMINGS OF THE MOVIE : "<<name[i]<<" :- "<<endl;
  197. int j=0;
  198.  
  199. getline(fin,tim[i][j],'\n');
  200. cout<<"\t\t\t\t\t\t\t";
  201. cout<<tim[i][j]<<endl<<endl;
  202.  
  203. i++;//to access the different movie names
  204. }
  205.  
  206. }
  207. void movie_booking::show()//this function is for entering the number of movie running in hall
  208. {
  209. int i,j;
  210. p=(int*)(malloc(sizeof(int)));
  211. cout<<"\n\n\t\t\t\t\t\t\tENTER THE NUMBER MOVIES RUNNING IN THE HALL\n";
  212. cout<<"\t\t\t\t\t\t\t";
  213. cin>>m;
  214. (*p)=m;
  215. ofstream fout;
  216. fout.open("movie_test2.csv",ios::app);
  217. for(i=0;i<m;i++)//m is the total no of movies running in that hall
  218. { fflush(stdin);
  219. cout<<"\n\n\t\t\t\t\t\t\tENTER THE NAME OF MOVIE "<<i+1<<endl;
  220. cout<<"\t\t\t\t\t\t\t";
  221. getline(cin,name[i]);
  222. fflush(stdin);
  223. fout<<name[i]<<",";//movie name writing in file
  224. cout<<"\n\n\t\t\t\t\t\t\tENTER THE NUMBER OF SHOWS OF MOVIE: "<<name[i]<<" IN A DAY : ";
  225. cin>>nt;
  226. str_tim[i]=nt;
  227. //here a function is to be added to save the show timings
  228. cout<<"\n\n\t\t\t\t\t\t\tENTER THE SHOW TIMINGS OF THE MOVIE : "<<name[i]<<endl;
  229. for(j=0;j<nt;j++)
  230. { fflush(stdin);
  231. cout<<"\t\t\t\t\t\t\t";
  232. getline(cin,tim[i][j]);// this is the function for collecting the show timings
  233. fout<<tim[i][j]<<",";
  234.  
  235. }
  236. fout<<endl;
  237.  
  238. }
  239. fout.close();
  240. //FILE HANDLING 100% CORRECT TILL HERE
  241. m=m+13;//as already is csv file there 13 movies
  242. (*this).show_seat_frm_file();
  243. }
  244.  
  245.  
  246. void movie_booking::seatdisp(int z,int wt)
  247. //1st argument to display the seats of that particular movie
  248. //2nd arg is for the particular movie time
  249. {
  250. arg=z;
  251. sti=wt;
  252. int i,j;
  253. char ch='A',st;
  254. system("clear");
  255. cout<<"\n\nCOST OF RECTILINEAR:Rs 500/-\n";
  256. cout<<"COST OF SUPER DELUXE :Rs 200/-\n";
  257. cout<<"COST OF DELUXE :Rs 100/-\n";
  258. ifstream fin;//this part is for retrieving moive name from file
  259. fin.open("movie_test2.csv");
  260. cout<<"\n\n\t\t\t\t\t\t\tBOOKED SEATS ARE MARKED WITH [x]\n\n";
  261. for(i=0;i<arg-1;i++)
  262. {
  263. getline(fin,name[i],'\n');
  264. }
  265. getline(fin,name[i],',');
  266. cout<<"\n\n\t\t\t\t\t\t\tTHIS IS THE SEAT MATRIX FOR MOVIE: "<<name[i]<<"\n\n";
  267. fin.close();
  268. for(i=0;i<13;i++)
  269. {
  270. ch='A';
  271. ch=ch+i;
  272. cout<<"\t";
  273. for(j=0;j<18;j++)
  274. {
  275. if(ar[obn][arg][sti][i][j]==1)
  276. cout<<"["<<" X"<<"]";
  277. else
  278. {
  279. cout<<"["<<ch<<j+1<<"]";
  280. }
  281.  
  282. cout<<" ";//1 white spaces given
  283. //the seat would be displayed in format[A1]
  284.  
  285. if(j==4||j==12)
  286. cout<<"\t";
  287.  
  288. }
  289. cout<<"\n\n";
  290. if(i==12)
  291. {
  292. cout<<"\n\n\t\t\t\t\t\t SCREEN THIS WAY\n";
  293. cout<<"\t______________________________________________________________________________________________________________";
  294. }
  295.  
  296. }
  297.  
  298. }
  299.  
  300.  
  301.  
  302.  
  303. void movie_booking::book(int z,int wt ,int a)//first argument is for the movie number and 3rd argument for manager mode
  304. //2nd arg is for show time
  305. {int i,j,num,al,n,col,stor,arg;
  306. arg=z;
  307. sti=wt;
  308. arg2=a;
  309. if(arg2==100)
  310. {
  311. cout<<"\n\n\t\t\t\t\t\t\tADMIN ENTER THE SEATS WHICH WONT BE AVAILABLE FOR BOOKING\n";
  312. }
  313.  
  314. else
  315. {
  316. cout<<"\n\n\t\t\t\t\t\t\tCUSTOMER BOOKING\n";
  317. }
  318.  
  319. (*this).seatdisp(arg,sti);
  320. char ch='A',chr;
  321. cout<<"\n\n\t\t\t\t\t\t\tENTER THE SEAT NUMBER\t";
  322.  
  323. cin>>chr>>col;
  324. stor=chr-65;
  325. col=col-1;
  326.  
  327. if(ar[obn][arg][sti][stor][col]==0)
  328. {
  329. ar[obn][arg][sti][stor][col]=1;
  330.  
  331. tkt_col[tkt]=col;
  332. tkt_row[tkt]=stor;
  333.  
  334.  
  335. }
  336. else
  337. {
  338.  
  339. while(ar[obn][arg][sti][stor][col]!=0)
  340. {
  341. if(arg2==100)
  342. {
  343. cout<<"\n\n\t\t\t\t\t\t\tADMIN YOU HAVE ALREADY MARKED THIS SEAT AS BOOKED ENTER A NEW SEAT WHICH IS BOOKED\n";
  344. cout<<"\t\t\t\t\t\t\t ";
  345. }
  346.  
  347. else
  348. {
  349. cout<<"\n\n\t\t\t\t\t\t\tTHE SEAT YOU SELECTED IS ALREADY OCCUPIED ENTER A NEW SEAT\n";
  350. cout<<"\t\t\t\t\t\t\t ";
  351. }
  352. cin>>chr>>col;
  353. stor=chr-65;
  354. col=col-1;
  355. }
  356. ar[obn][arg][sti][stor][col]=1;
  357. tkt_col[tkt]=col;
  358. tkt_row[tkt]=stor;
  359. }
  360.  
  361. }
  362.  
  363. void movie_booking::seatin(int z,int wt)//1st argument for the particular movie seat booking
  364. //2nd arg is for particular show time of particular movie
  365. {
  366.  
  367. int n,i;
  368. arg=z;
  369. sti=wt;
  370. //cout<<"THE ARGUMENT IS nest="<<arg<<endl;
  371. cout<<"\n\n\t\t\t\t\t\t\tENTER THE NUMBER OF SEATS TO BE BOOKED"<<endl;
  372. ifstream fin;//this part is for retrieving moive name from file
  373. fin.open("movie_test2.csv");
  374. cout<<"\n\n\t\t\t\t\t\t\tBOOKED SEATS ARE MARKED WITH [x]\n\n";
  375.  
  376. for(i=0;i<arg-1;i++)
  377. {
  378. getline(fin,name[i],'\n');
  379. }
  380. getline(fin,name[i],',');
  381.  
  382. cout<<"\t\t\t\t\t\t\t MOVIE NAME="<<name[i]<<endl;
  383. fin.close();
  384. cout<<"\t\t\t\t\t\t\t ";
  385. cin>>n;
  386. tkt_pr=n;
  387. for(tkt=0;tkt<n;tkt++)//loop for booking the desired no. of tickets as input by user
  388. {
  389. (*this).book(arg,sti,20);
  390. cout<<"LOOP IS RUNNING\n";
  391. system("clear");
  392. (*this).seatdisp(arg,sti);
  393.  
  394. }
  395. cout<<"\n\n\t\t\t\t\t\t\tPRESS ANY KEY TO CONTINUE\n";
  396. // CLEAR();
  397. system("clear");
  398.  
  399. }
  400.  
  401.  
  402.  
  403.  
  404. void movie_booking::manager()
  405. { char mov='c',in='c';
  406. (*this).show();
  407. while((mov=='c')||(mov=='C'))//this loop is for entering the seats that are booked for different movies
  408. {
  409. cout<<"\n\n\t\t\t\t\t\t\t ENTER THE SHOW NUMBER WHOSE SEATS U WANT TO ASSIGN FOR BOOKING\n";
  410. cout<<"\t\t\t\t\t\t\t";
  411. cin>>sn;
  412. cout<<"\n\n\t\t\t\t\t\t\t ENTER THE NUMBER CORRESPONDING TO THE TIME TO BOOK TICKET\n";
  413. cout<<"\t\t\t\t\t\t\t";
  414. cin>>sti;
  415. tkt_pnt=name[sn];
  416.  
  417. while((in=='c')||(in=='C'))
  418. {
  419. (*this).book(sn,sti,100);
  420. system("clear");
  421. (*this).seatdisp(sn,sti);
  422. cout<<"\n\n\t\t\t\t\t\t\tPRESS 'C' or 'c' IF U WANT TO CONTINUE ENTERING THE BOOKED SEATS\n";
  423. cout<<"\t\t\t\t\t\t\t";
  424. cin>>in;
  425. }
  426.  
  427. cout<<"\n\n\t\t\t\t\t\t\tPRESS 'C' or 'c' IF U WANT TO CONTINUE ENTERING FOR OTHER MOVIES\n";
  428. cout<<"\t\t\t\t\t\t\t";
  429. cin>>mov;
  430. in='c';
  431. }
  432. mv_str++;
  433.  
  434. }
  435.  
  436. void movie_booking::ticket_print()
  437. { int i,a=0,b=0,d=0;
  438. char c;
  439. string time;//time to store the movie timing
  440.  
  441. for(i=0;i<tkt_pr;i++)//this loop is for printing the total cost of ticket
  442. {
  443.  
  444.  
  445. if(tkt_row[i]==0||tkt_row[i]==1)
  446. {
  447. cost=cost+500;
  448. a++;
  449. }
  450. else if(tkt_row[i]>1&&tkt_row[i]<7)
  451. {
  452. cost=cost+200;
  453. b++;
  454. }
  455. else{cost=cost+100;d++;}
  456.  
  457.  
  458. }
  459. cout<<"\n\n\n\t\t\tCOST : "<<endl;
  460. if(a!=0)
  461. cout<<"\t\t\t "<<a<<" * 500"<<endl;
  462. if(b!=0)
  463. cout<<"\t\t\t +"<<b<<" * 200"<<endl;
  464. if(c!=0)
  465. cout<<"\t\t\t +"<<d<<" * 100"<<endl;
  466. cout<<"GST 18% = "<<cost*0.18<<endl;
  467. cost=cost+cost*(0.18);
  468. cout<<"\n\n\n\n\t\t\tTHE TOTAL TICKET COST = Rs "<<cost<<"/-"<<endl;
  469. cout<<"\n\nPRESS ANY KEY TO CONTINUE\n";
  470. // CLEAR();
  471. system("clear");
  472.  
  473. system("clear");
  474. ifstream fin;//this part is for retrieving moive name from file
  475. fin.open("movie_test2.csv");
  476.  
  477. for(i=0;i<arg-1;i++)
  478. {
  479. getline(fin,name[i],'\n');
  480. }
  481. getline(fin,name[i],',');
  482.  
  483. for(int j=0;j<sti;j++)
  484. {
  485. getline(fin,time,',');
  486. }
  487. fin.close();
  488. (*this).hal_name();
  489. cout<<"\n\n\n\n\t\t\t________________________________________________________________________\n";
  490. cout<<"\t\t\t| |\n";
  491. cout<<"\t\t\t| Dear Customer, |\n";
  492. cout<<"\t\t\t| Congratulation!! Your tickets has been booked. |\n";
  493. cout<<"\t\t\t| |\n";
  494. cout<<"\t\t\t| THE DETAILS: |\n";
  495. cout<<"\t\t\t| MOVIE HALL: "<<hall_name<<" \n";
  496. cout<<"\t\t\t| MOVIE NAME: "<<name[i]<<" \n";
  497. cout<<"\t\t\t| SHOW STARTS:"<<time<<" \n";
  498. cout<<"\t\t\t| NUMBER OF TICKETS BOOKED: "<<tkt_pr<<" |\n";
  499. cout<<"\t\t\t| THE SEAT NUMBERS ARE: ";for(i=0;i<tkt_pr;i++)
  500. { c=tkt_row[i]+65;
  501. cout<<c<<tkt_col[i]+1;//PLS CHECK WHY I HV WRITTEN HERE +
  502. if(i<tkt-1)
  503. {
  504. cout<<",";
  505. }
  506. }
  507. cout<<" \n";
  508. cout<<"\t\t\t| QR CODE |\n";
  509. cout<<"\t\t\t| ..++>>> |\n";
  510. cout<<"\t\t\t| ..__*** |\n";
  511. cout<<"\t\t\t| &%^>>>> |\n";
  512. cout<<"\t\t\t| ::::::: |\n";
  513. cout<<"\t\t\t|_______________________________________________________________________|\n";
  514.  
  515. cout<<"\t\t\t\t\t\t\t\"PROJECT CREATED N IMPLEMENTED BY:\""<<endl;
  516. cout<<"\t\t\t\t\t\t\t\t\t\t -KHITISH PANIGRAHI[CPPSECRETS]";
  517. }
  518.  
  519. void movie_booking::pass_proctect()//to protect the password
  520. {
  521.  
  522. int ps=0,star=0;// to count the characters in password
  523.  
  524. //star is to print the password in * format
  525. //pas[-1]=0;//intialised just like that "I GUESS ITS NIT REQUIRED"
  526. cout<<"\n\n\t\t\t\t\t\t\tENTER THE MANAGER PASSWORD\n";
  527. cout<<"\t\t\t\t\t\t\t";
  528.  
  529. cin>>pass;
  530. ps=pass.length();
  531. system("clear");
  532. while(star<ps)
  533. { if(star==0)
  534. {
  535. cout<<"\n\n\t\t\t\t\t\t\tENTER THE MANAGER PASSWORD\n\n";
  536.  
  537. cout<<"\t\t\t\t\t\t\t\t";
  538.  
  539. }
  540.  
  541. cout<<" * ";
  542. star++;
  543. }
  544.  
  545. }
  546.  
  547. void movie_booking::data_str()
  548. {
  549. ofstream fout;
  550. fout.open("database1.csv",ios::app);
  551. string name1,name2,usr_id,usr_psd;
  552. /*format to be save is 1st name,title,user id,age,password*/
  553. fflush(stdin);
  554.  
  555.  
  556. cout<<"\t\t\t\t\t\t\tENTER THE FIRST NAME\n";
  557. fflush(stdin);
  558. getline(cin,name1);
  559. cout<<"\t\t\t\t\t\t\tENTER THE LAST NAME\n";
  560. fflush(stdin);
  561. getline(cin,name2);
  562. cout<<"\t\t\t\t\t\t\tENTER THE USER ID\n";
  563. fflush(stdin);
  564. getline(cin,usr_id);
  565. cout<<"\t\t\t\t\t\t\tENTER THE USER PASSWORD\n";
  566. fflush(stdin);
  567. getline(cin,usr_psd);
  568. fout<<name1<<","<<name2<<","<<usr_id<<","<<usr_psd<<endl;
  569.  
  570. fout.close();
  571. data_store=1;
  572. }
  573. int movie_booking::password_check()
  574. {
  575. cout<<"\n\n\t\t\t\t\t\t\tENTER YOUR USER ID\n";
  576. fflush(stdin);
  577. cout<<"\t\t\t\t\t\t\t";
  578.  
  579. cin>>cus_id;
  580. ifstream myfile;
  581. myfile.open("database1.csv");
  582. while(!myfile.eof())
  583. {
  584. getline(myfile,user,',');
  585. getline(myfile,user,',');
  586. getline(myfile,user,',');
  587. getline(myfile,pass,'\n');
  588. fflush(stdin);
  589.  
  590. fflush(stdin);
  591. if(user==cus_id||pass==cus_id)
  592. {
  593. foundu++;
  594. prnt_once++;
  595. if(prnt_once==1)
  596. cout<<"\n\n\t\t\t\t\t\t\tUSER ID FOUND\n";
  597. }
  598.  
  599.  
  600. }
  601.  
  602. if(foundu==0)
  603. {cout<<"\n\n\t\t\t\t\t\t\tUSER ID NOT FOUND\n";
  604. myfile.close();
  605. }
  606. else
  607. {
  608. myfile.close();
  609. cout<<"\n\n\t\t\t\t\t\t\tENTER YOUR USER PASSWORD\n";
  610. fflush(stdin);
  611. cout<<"\t\t\t\t\t\t\t";
  612. cin>>cus_pas;
  613. myfile.open("database1.csv");
  614. while(!myfile.eof())
  615. {
  616. getline(myfile,user,',');
  617. getline(myfile,user,',');
  618. getline(myfile,user,',');
  619. getline(myfile,pass,'\n');
  620. fflush(stdin);
  621.  
  622. fflush(stdin);
  623. if(pass==cus_pas)
  624. {
  625. foundp++;
  626. cout<<"\n\n\t\t\t\t\t\t\tPASSWORD MATCHED\n";
  627. }
  628.  
  629.  
  630. }
  631.  
  632. }
  633.  
  634. if(foundp==0)
  635. cout<<"\n\n\t\t\t\t\t\t\tPASSWORD IS WRONG\n";
  636.  
  637.  
  638. myfile.close();
  639. return foundp;
  640.  
  641.  
  642. }
  643.  
  644. int main()
  645. {
  646. prnt_once=0;
  647. movie_booking obj[4];
  648. while(1)
  649. {
  650. cout<<"\n\n\t\t\t\t\t\t\t PRESS 1 TO BOOK TICKET IN INOX BHUBANESWAR";
  651. cout<<"\n\n\t\t\t\t\t\t\t PRESS 2 TO BOOK TICKET IN CINEPOLIS BHUBANESWAR";
  652. cout<<"\n\n\t\t\t\t\t\t\t PRESS 3 TO BOOK TICKET IN KESHARI TALKIES ";
  653. cout<<"\n\n\t\t\t\t\t\t\t PRESS 4 TO BOOK TICKET IN MAHARAJA";
  654. cout<<"\n\n\t\t\t\t\t\t\t TO EXIT PROGRAM PRESS 9 ";
  655. cout<<"\n\n\t\t\t\t\t\t\t ";
  656. cin>>obn;
  657. switch(obn)
  658. {
  659. case 1:
  660. cout<<"\t\t\t\t\t\t\t";
  661. cout<<"INOX BHUBANESWAR IS SELECTED\n";
  662. obj[0].first();
  663. break;
  664. case 2:
  665. cout<<"\t\t\t\t\t\t\t";
  666. cout<<"CINEPOLIS BHUBANESWAR IS SELECTED\n";
  667. obj[1].first();
  668. break;
  669. case 3:
  670. cout<<"\t\t\t\t\t\t\t";
  671. cout<<"KESHARI TALKIES BHUBANESWAR IS SELECTED\n";
  672. obj[2].first();
  673. break;
  674. case 4:
  675. cout<<"\t\t\t\t\t\t\t";
  676. cout<<"MAHARAJA BHUBANESWAR IS SELECTED\n";
  677. obj[3].first();
  678. break;
  679. case 9:
  680. goto bye;
  681. break;
  682. default:
  683. cout<<"enter a valid number\n";
  684. goto bye;
  685. break;
  686. }
  687.  
  688.  
  689. }
  690.  
  691.  
  692.  
  693. bye:
  694. cout<<"its working WITH file handling \n";
  695. system("clear");
  696. cout<<"\n\n\n\n\t\t\t\t\t\t\t THANK YOU FOR USING OUR APPLICATION!!!!";
  697. return 0;
  698.  
  699. }
  700.  
  701.  
  702.  
Success #stdin #stdout #stderr 0.01s 5312KB
stdin
45
stdout

							 PRESS 1 TO BOOK TICKET IN INOX BHUBANESWAR

							 PRESS 2 TO BOOK TICKET IN CINEPOLIS BHUBANESWAR

							 PRESS 3 TO BOOK TICKET IN KESHARI TALKIES 

							 PRESS 4 TO BOOK TICKET IN MAHARAJA

							 TO EXIT PROGRAM PRESS 9 

							 enter a valid number
its working WITH file handling 




							 THANK YOU FOR USING OUR APPLICATION!!!!
stderr
TERM environment variable not set.