C++ URGENT HELP PLZ PLZ PLZ help me

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Jul 2009
Posts: 6
Reputation: shaneera is an unknown quantity at this point 
Solved Threads: 0
shaneera shaneera is offline Offline
Newbie Poster

C++ URGENT HELP PLZ PLZ PLZ help me

 
0
  #1
Jul 25th, 2009
PLEASE EDIT this code if u can .
this is my c++ Assgnment it is about reserving air tickets.
if u can help me 2 insert delete & Edit a air ticket functions to the main menu please please please help me my friendz...

I wz managed 2 save d details in a txt file but i need 2 edit & delete the text file please help me ..& i need 2 insert edit the file & delete the file into d main menu please help me..I hav 2 submit tis on 28 morning plz help me if u can

  1. # include<iostream>
  2. #include<string>
  3. #include<windows.h>
  4. #include<fstream>
  5. using namespace std;
  6.  
  7. ofstream outf("ticket.txt");
  8. int selct;
  9. char ch;
  10.  
  11. class passenger{
  12.  
  13. public:
  14.  
  15. int age,idno,routeno;
  16. double tic,tic3,tic5;
  17. string to,name,sex;
  18. public:
  19.  
  20. void ticketprice(){
  21. cout<<" (1) WATCH PRICES "<<endl;
  22. cout<<""<<endl;
  23. cout<<""<<endl;
  24. cout<<""<<endl;
  25. cout<<""<<endl;
  26.  
  27. cout<<"-----------------------------------------------------------------------------"<<endl;
  28. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  29. cout<<" Route - Economy class - Business class "<<endl;
  30. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  31.  
  32. cout<<"-----------------------------------------------------------------------------"<<endl;
  33. cout<<"- Colombo - - -"<<endl;
  34. cout<<"- to - 070,000 - 086,100 -"<<endl;
  35. cout<<"- Washington - - -"<<endl;
  36. cout<<"-----------------------------------------------------------------------------"<<endl;
  37. cout<<"- Colombo - - -"<<endl;
  38. cout<<"- to - 080,000 - 098,400 -"<<endl;
  39. cout<<"- Paris - - -"<<endl;
  40. cout<<"-----------------------------------------------------------------------------"<<endl;
  41. cout<<"- Colombo - - -"<<endl;
  42. cout<<"- to - 050,000 - 061,500 -"<<endl;
  43. cout<<"- London - - -"<<endl;
  44. cout<<"-----------------------------------------------------------------------------"<<endl;
  45.  
  46. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
  47. cout<<""<<endl;
  48. cout<<""<<endl;
  49.  
  50. cout<<" ============ "<<endl;
  51. cout<<" = NOTICE = "<<endl;
  52.  
  53. cout<<" ============ "<<endl;
  54. cout<<""<<endl;
  55. cout<<""<<endl;
  56. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  57. cout<<"*****************************************************************"<<endl;
  58. cout<<"** **IF (AGE <4) 50% DISCOUNT ON THEIR TICKET **"<<endl;
  59. cout<<" **"<<endl;
  60. cout<<""<<endl;
  61. cout<<"** **IF (4 <AGE<15) 25% DISCOUNT ON THEIR TICKET **"<<endl;
  62. cout<<" **"<<endl;
  63. cout<<" **"<<endl;
  64. cout<<"** **IF (15 <AGE<18) 10% DISCOUNT ON THEIR TICKET **"<<endl;
  65. cout<<"*****************************************************************"<<endl;
  66.  
  67. }
  68.  
  69. void getdata(){
  70. cout<<" (2) RESERVE A TICKET "<<endl;
  71. cout<<""<<endl;
  72. cout<<""<<endl;
  73. cout<<""<<endl;
  74. cout<<""<<endl;
  75.  
  76. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
  77.  
  78. cout<<"******************************************************************************"<<endl;
  79. cout<<""<<endl;
  80. cout<<""<<endl;
  81. cout<<""<<endl;
  82. cout<<""<<endl;
  83. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  84. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  85.  
  86. cout<<"** PLEASE ENTER YOUR NAME HERE : ";
  87. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  88.  
  89. cin>>name;
  90. outf<<"PASSENGER'S NAME IS : "<<name<<endl;
  91. cout<<""<<endl;
  92. cout<<""<<endl;
  93. cout<<""<<endl;
  94. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  95.  
  96. cout<<"** PLEASE ENTER YOUR SEX HERE (male/female) : ";
  97. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  98.  
  99. cin>>sex;
  100. outf<<"SEX OF THE PASSENGER : "<<sex<<endl;
  101. cout<<""<<endl;
  102. cout<<""<<endl;
  103. cout<<""<<endl;
  104. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  105.  
  106. cout<<"** PLEASE ENTER YOUR AGE HERE : ";
  107. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  108.  
  109. cin>>age;
  110. outf<<"PASSENGER'S AGE IS : "<<age<<endl;
  111.  
  112. cout<<""<<endl;
  113. cout<<""<<endl;
  114. cout<<""<<endl;
  115. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  116.  
  117. cout<<"** PLEASE ENTER YOUR IDENTITY CARD NUMBER HERE : ";
  118. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  119.  
  120. cin>>idno;
  121. outf<<"PASSENGER'S IDENTITY CARD NUMBER IS :"<<idno<<endl;
  122. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
  123. cout<<""<<endl;
  124. cout<<""<<endl;
  125. cout<<""<<endl;
  126. cout<<""<<endl;
  127. cout<<"******************************************************************************"<<endl;
  128.  
  129. cout<<""<<endl;
  130. cout<<""<<endl;
  131. cout<<""<<endl;
  132. cout<<""<<endl;
  133. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  134.  
  135. cout<<" *********************************"<<endl;
  136. cout<<" *********************************"<<endl;
  137. cout<<" ** (1) Economic Class **"<<endl;
  138. cout<<" ** **"<<endl;
  139. cout<<" ** (2) Business Class **"<<endl;
  140. cout<<" *********************************"<<endl;
  141. cout<<" *********************************"<<endl;
  142.  
  143. cout<<""<<endl;
  144. cout<<""<<endl;
  145. cout<<""<<endl;
  146. cout<<""<<endl;
  147.  
  148. cout<<"Please select one of the above selections :- ";
  149. cin>>selct;
  150.  
  151. cout<<""<<endl;
  152. cout<<""<<endl;
  153. cout<<""<<endl;
  154. cout<<""<<endl;
  155. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  156.  
  157. cout<<" The Available Destinations are"<<endl;
  158. cout<<""<<endl;
  159. cout<<""<<endl;
  160. cout<<" #####################################"<<endl;
  161. cout<<" ### ###"<<endl;
  162. cout<<" ### 1 - Colombo to Washington ###"<<endl;
  163. cout<<" ### 2 - Colombo to Paris ###"<<endl;
  164. cout<<" ### 3 - Colombo to London ###"<<endl;
  165. cout<<" ### ###"<<endl;
  166. cout<<" #####################################"<<endl;
  167. cout<<""<<endl;
  168. cout<<""<<endl;
  169. cout<<"Please select one of the above route numbers :-";
  170. cin>>routeno;
  171.  
  172.  
  173.  
  174.  
  175. }
  176.  
  177. double calticprice(){
  178.  
  179.  
  180. if(routeno==1){
  181.  
  182. tic=70000;
  183. }
  184.  
  185. else if (routeno==2){
  186.  
  187. tic=80000;
  188.  
  189. }
  190.  
  191. else if(routeno==3){
  192.  
  193. tic=50000;
  194. }
  195. return tic;
  196.  
  197. }
  198.  
  199. void calage(){
  200. double tic2=tic;
  201. if(age<=4){
  202. tic3=(tic2*50)/100;
  203. }
  204. else if((age>5)&&(age<=15)){
  205. tic3=(tic2*75)/100;
  206. }
  207.  
  208. else if((age>16)&&(age<18)){
  209.  
  210. tic3=(tic2*90)/100;
  211.  
  212. }
  213.  
  214. else{
  215.  
  216. tic3=tic2;
  217.  
  218. }
  219. }
  220.  
  221. void display(){
  222. system("cls");
  223. cout<<""<<endl;
  224. cout<<""<<endl;
  225. cout<<""<<endl;
  226.  
  227. cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
  228. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  229.  
  230. cout<<" TICKET DETAILS "<<endl;
  231. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  232.  
  233. cout<<"%%% NAME OF THE CUSTOMER :"<<name<<endl;
  234. cout<<""<<endl;
  235. cout<<""<<endl;
  236. cout<<"%%% AGE OF THE CUSTOMER :"<<age<<endl;
  237. cout<<""<<endl;
  238. cout<<""<<endl;
  239. cout<<"%%% NIC OF THE CUSTOMER :"<<idno<<endl;
  240. cout<<""<<endl;
  241. cout<<""<<endl;
  242. cout<<"%%% SEAT NUMBER OF THE CUTOMER :"<<seatnum<<endl;
  243. cout<<""<<endl;
  244. cout<<""<<endl;
  245. cout<<"THE FLIGHT NUMBER IS : FL110 "<<endl;
  246. cout<<""<<endl;
  247. cout<<""<<endl;
  248. cout<<"YOUR RESERVED DATE IS : 2009 10 28"<<endl;
  249. cout<<""<<endl;
  250.  
  251. if(selct==1){
  252. cout<<"TICKET PRICE :"<<tic3<<endl;
  253. }
  254. else if(selct==2){
  255. cout<<"TICKET PRICE :"<<tic5<<endl;
  256. }
  257. cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
  258.  
  259. }
  260.  
  261. void seatnum(){
  262. int seat;
  263. int seatnum=0;
  264.  
  265. cout<<""<<endl;
  266. cout<<""<<endl;
  267. cout<<""<<endl;
  268. cout<<"DETAILS OF YOUR TICKET HAS BEEN SUCCESSFULLY UPDATED TO OUR COMPANY "<<endl;
  269.  
  270. cout<<" FINALLY PLEASE ENTER THE SEAT NUMBER - ";
  271. cin>>seat;
  272. cout<<endl;
  273. if(seatnum!=seat){
  274. seatnum=seat;
  275. cout<<"SUCCESSFUL"<<endl;
  276. }
  277. else{
  278. cout<<"SORRY"<<endl;
  279. if(seatnum!=seat){
  280. seatnum=seat;
  281. cout<<"SUCCESSFUL"<<endl;
  282. }
  283. }
  284.  
  285. }
  286.  
  287. };
  288.  
  289. class economic:public passenger{
  290. public:
  291. void getdata(){
  292.  
  293. passenger::getdata();
  294.  
  295. }
  296.  
  297. void calticprice2(){
  298.  
  299. passenger::calticprice();
  300.  
  301.  
  302.  
  303.  
  304. }
  305.  
  306. void seatnum(){
  307. passenger::seatnum();
  308. }
  309.  
  310.  
  311. };
  312.  
  313.  
  314. class business:public passenger{
  315. public:
  316. void getdata(){
  317.  
  318. passenger::getdata();
  319.  
  320. }
  321.  
  322. void calticprice3(){
  323.  
  324. passenger::calticprice();
  325. double tic4=tic;
  326. if(age<=4){
  327. tic5=(tic4*123/100)*50/100;
  328. }
  329. else if((age>=5)&&(age<=15)){
  330. tic5=(tic4*123/100)*75/100;
  331. }
  332.  
  333. else if((age>16)&&(age<18)){
  334.  
  335. tic5=(tic4*123/100)*90/100;
  336.  
  337. }
  338.  
  339. else{
  340.  
  341. tic5=(tic4*123)/100;
  342.  
  343. }
  344.  
  345.  
  346. }
  347. void seatnum(){
  348. passenger::seatnum();
  349. }
  350.  
  351.  
  352. };
  353.  
  354. //void seatnum();
  355.  
  356.  
  357. int main(){
  358.  
  359. int menuselect;
  360. char c;
  361.  
  362. passenger p1;
  363. do{
  364. system("cls");
  365. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 10);
  366. cout<<"******************************************************************************"<<endl;
  367. cout<<"* *"<<endl;
  368. cout<<"* WELCOME TO THE TRAVEL LINE AIRLINE TRANSPORTATION COMPANY *"<<endl;
  369. cout<<"* *"<<endl;
  370. cout<<"* TICKET RESERVATION PROGRAM *"<<endl;
  371. cout<<"* *"<<endl;
  372. cout<<"* *"<<endl;
  373. cout<<"******************************************************************************"<<endl;
  374.  
  375.  
  376. cout<<""<<endl;
  377. cout<<""<<endl;
  378. cout<<""<<endl;
  379. cout<<""<<endl;
  380.  
  381. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  382. cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
  383. cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
  384. cout<<"~~~~~ MAIN MENU ~~~~"<<endl;
  385. cout<<"~~~~~ ~~~~"<<endl;
  386. cout<<"~~~~~ (1) Watch the prices ~~~~"<<endl;
  387. cout<<"~~~~~ ~~~~"<<endl;
  388. cout<<"~~~~~ (2) Reserve a ticket ~~~~"<<endl;
  389. cout<<"~~~~~ ~~~~"<<endl;
  390. cout<<"~~~~~ ~~~~"<<endl;
  391. cout<<"~~~~~ ~~~~"<<endl;
  392. cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
  393. cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
  394. cout<<""<<endl;
  395. cout<<""<<endl;
  396. cout<<""<<endl;
  397. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  398. cout<<""<<endl;
  399. cout<<""<<endl;
  400. cout<<""<<endl;
  401. cout<<""<<endl;
  402. cout<<"Please select one of the above selections :-";
  403. cin>>menuselect;
  404.  
  405. if(menuselect==1){
  406. system("cls");
  407. p1.ticketprice();
  408. cout<<""<<endl;
  409. cout<<""<<endl;
  410. cout<<""<<endl;
  411. cout<<""<<endl;
  412. cout<<"do u want to Reserve a ticket(y/n)";
  413. cin>>c;
  414. if(c=='y')
  415. {
  416. system("cls");
  417. p1.getdata();
  418. p1.calticprice();
  419. p1.calage();
  420. p1.seatnum();
  421. p1.display();
  422.  
  423. }
  424.  
  425. else if(c=='n'){
  426.  
  427. cout<<"Thank you Very much for using our travelline ticket reservation program good bye"<<endl;
  428. system("cls");
  429. }
  430.  
  431. }
  432. else if(menuselect==2){
  433. system("cls");
  434. if(selct=1){
  435. //case 1:
  436. economic e1;
  437. e1.getdata();
  438. e1.calticprice2();
  439. e1.calage();
  440. e1.seatnum();
  441. e1.display();
  442.  
  443. //break;
  444. }
  445. else if(selct=2){
  446. business b1;
  447. b1.getdata();
  448. b1.calticprice3();
  449. b1.calage();
  450.  
  451. b1.seatnum();
  452. b1.display();
  453. //break;
  454. }
  455. else{
  456. cout<<"Invalid selection"<<endl;
  457. }
  458. //}
  459. //else if(select==2){
  460.  
  461.  
  462. }
  463. cout<<"DO U WANT TO CONTINUE?(y/n) ";
  464. cin>>ch;
  465. }while(ch!='n');
  466.  
  467.  
  468. return 0;
  469.  
  470.  
  471. }
Last edited by Ancient Dragon; Jul 26th, 2009 at 9:41 am. Reason: add code tags
Reply With Quote Quick reply to this message  
Join Date: Feb 2008
Posts: 634
Reputation: daviddoria is a jewel in the rough daviddoria is a jewel in the rough daviddoria is a jewel in the rough 
Solved Threads: 46
daviddoria daviddoria is offline Offline
Practically a Master Poster

Re: C++ URGENT HELP PLZ PLZ PLZ help me

 
1
  #2
Jul 25th, 2009
You cannot just post a bunch of code and expect us to do your assignment.
1) use code tags so the code you do post is readable
2) extract the problem you are having in to the smallest example possible ( < 20 lines) with sample input, expected output, current (incorrect) output, and any errors that are generated)
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,850
Reputation: Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute Salem has a reputation beyond repute 
Solved Threads: 749
Team Colleague
Salem's Avatar
Salem Salem is offline Offline
Void main'ers are DOOMed
Join Date: Jul 2009
Posts: 6
Reputation: shaneera is an unknown quantity at this point 
Solved Threads: 0
shaneera shaneera is offline Offline
Newbie Poster

Re: C++ URGENT HELP PLZ PLZ PLZ help me

 
0
  #4
Jul 25th, 2009
bro

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"~~~~~ MAIN MENU ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~ (1) Watch the prices ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~ (2) Reserve a ticket ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;


this is the main menu plz if u can add delete & edit items to this one refer ma code please plz plz plz
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 6
Reputation: shaneera is an unknown quantity at this point 
Solved Threads: 0
shaneera shaneera is offline Offline
Newbie Poster

Re: C++ URGENT HELP PLZ PLZ PLZ help me

 
0
  #5
Jul 25th, 2009
hei plz help me if u can
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 3,829
Reputation: VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute VernonDozier has a reputation beyond repute 
Solved Threads: 501
Featured Poster
VernonDozier VernonDozier is offline Offline
Senior Poster

Re: C++ URGENT HELP PLZ PLZ PLZ help me

 
0
  #6
Jul 25th, 2009
Originally Posted by shaneera View Post
bro

cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"~~~~~ MAIN MENU ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~ (1) Watch the prices ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~ (2) Reserve a ticket ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~ ~~~~"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;


this is the main menu plz if u can add delete & edit items to this one refer ma code please plz plz plz

Code tags. Read Salem's links regarding how. What exactly do you want? Add some cout statements for "delete" and "edit" to the menu above. No one is going to go through your first post without line numbered C++ code tags.


[code=cplusplus]
// paste code here
[/code]


You need to ask a specific question using clear English and point us towards specific line numbers. Anything sounding like "Do this for me..." is going to be ignored by most people.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 1,395
Reputation: evstevemd has a spectacular aura about evstevemd has a spectacular aura about evstevemd has a spectacular aura about 
Solved Threads: 127
evstevemd's Avatar
evstevemd evstevemd is offline Offline
Nearly a Posting Virtuoso

Re: C++ URGENT HELP PLZ PLZ PLZ help me

 
0
  #7
Jul 25th, 2009
Originally Posted by VernonDozier View Post
Code tags. Read Salem's links regarding how. What exactly do you want? Add some cout statements for "delete" and "edit" to the menu above. No one is going to go through your first post without line numbered C++ code tags.


[code=cplusplus]
// paste code here
[/code]


  1. # include<iostream>
  2. #include<string>
  3. #include<windows.h>
  4. #include<fstream>
  5. using namespace std;
  6.  
  7. ofstream outf("ticket.txt");
  8. int selct;
  9. char ch;
  10.  
  11. class passenger{
  12.  
  13. public:
  14.  
  15. int age,idno,routeno;
  16. double tic,tic3,tic5;
  17. string to,name,sex;
  18. public:
  19.  
  20. void ticketprice(){
  21. cout<<" (1) WATCH PRICES "<<endl;
  22. cout<<""<<endl;
  23. cout<<""<<endl;
  24. cout<<""<<endl;
  25. cout<<""<<endl;
  26.  
  27. cout<<"-----------------------------------------------------------------------------"<<endl;
  28. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  29. cout<<" Route - Economy class - Business class "<<endl;
  30. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  31.  
  32. cout<<"-----------------------------------------------------------------------------"<<endl;
  33. cout<<"- Colombo - - -"<<endl;
  34. cout<<"- to - 070,000 - 086,100 -"<<endl;
  35. cout<<"- Washington - - -"<<endl;
  36. cout<<"-----------------------------------------------------------------------------"<<endl;
  37. cout<<"- Colombo - - -"<<endl;
  38. cout<<"- to - 080,000 - 098,400 -"<<endl;
  39. cout<<"- Paris - - -"<<endl;
  40. cout<<"-----------------------------------------------------------------------------"<<endl;
  41. cout<<"- Colombo - - -"<<endl;
  42. cout<<"- to - 050,000 - 061,500 -"<<endl;
  43. cout<<"- London - - -"<<endl;
  44. cout<<"-----------------------------------------------------------------------------"<<endl;
  45.  
  46. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
  47. cout<<""<<endl;
  48. cout<<""<<endl;
  49.  
  50. cout<<" ============ "<<endl;
  51. cout<<" = NOTICE = "<<endl;
  52.  
  53. cout<<" ============ "<<endl;
  54. cout<<""<<endl;
  55. cout<<""<<endl;
  56. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  57. cout<<"*****************************************************************"<<endl;
  58. cout<<"** **IF (AGE <4) 50% DISCOUNT ON THEIR TICKET **"<<endl;
  59. cout<<" **"<<endl;
  60. cout<<""<<endl;
  61. cout<<"** **IF (4 <AGE<15) 25% DISCOUNT ON THEIR TICKET **"<<endl;
  62. cout<<" **"<<endl;
  63. cout<<" **"<<endl;
  64. cout<<"** **IF (15 <AGE<18) 10% DISCOUNT ON THEIR TICKET **"<<endl;
  65. cout<<"*****************************************************************"<<endl;
  66.  
  67. }
  68.  
  69. void getdata(){
  70. cout<<" (2) RESERVE A TICKET "<<endl;
  71. cout<<""<<endl;
  72. cout<<""<<endl;
  73. cout<<""<<endl;
  74. cout<<""<<endl;
  75.  
  76. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
  77.  
  78. cout<<"******************************************************************************"<<endl;
  79. cout<<""<<endl;
  80. cout<<""<<endl;
  81. cout<<""<<endl;
  82. cout<<""<<endl;
  83. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  84. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  85.  
  86. cout<<"** PLEASE ENTER YOUR NAME HERE : ";
  87. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  88.  
  89. cin>>name;
  90. outf<<"PASSENGER'S NAME IS : "<<name<<endl;
  91. cout<<""<<endl;
  92. cout<<""<<endl;
  93. cout<<""<<endl;
  94. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  95.  
  96. cout<<"** PLEASE ENTER YOUR SEX HERE (male/female) : ";
  97. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  98.  
  99. cin>>sex;
  100. outf<<"SEX OF THE PASSENGER : "<<sex<<endl;
  101. cout<<""<<endl;
  102. cout<<""<<endl;
  103. cout<<""<<endl;
  104. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  105.  
  106. cout<<"** PLEASE ENTER YOUR AGE HERE : ";
  107. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  108.  
  109. cin>>age;
  110. outf<<"PASSENGER'S AGE IS : "<<age<<endl;
  111.  
  112. cout<<""<<endl;
  113. cout<<""<<endl;
  114. cout<<""<<endl;
  115. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  116.  
  117. cout<<"** PLEASE ENTER YOUR IDENTITY CARD NUMBER HERE : ";
  118. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  119.  
  120. cin>>idno;
  121. outf<<"PASSENGER'S IDENTITY CARD NUMBER IS :"<<idno<<endl;
  122. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 12);
  123. cout<<""<<endl;
  124. cout<<""<<endl;
  125. cout<<""<<endl;
  126. cout<<""<<endl;
  127. cout<<"******************************************************************************"<<endl;
  128.  
  129. cout<<""<<endl;
  130. cout<<""<<endl;
  131. cout<<""<<endl;
  132. cout<<""<<endl;
  133. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  134.  
  135. cout<<" *********************************"<<endl;
  136. cout<<" *********************************"<<endl;
  137. cout<<" ** (1) Economic Class **"<<endl;
  138. cout<<" ** **"<<endl;
  139. cout<<" ** (2) Business Class **"<<endl;
  140. cout<<" *********************************"<<endl;
  141. cout<<" *********************************"<<endl;
  142.  
  143. cout<<""<<endl;
  144. cout<<""<<endl;
  145. cout<<""<<endl;
  146. cout<<""<<endl;
  147.  
  148. cout<<"Please select one of the above selections :- ";
  149. cin>>selct;
  150.  
  151. cout<<""<<endl;
  152. cout<<""<<endl;
  153. cout<<""<<endl;
  154. cout<<""<<endl;
  155. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  156.  
  157. cout<<" The Available Destinations are"<<endl;
  158. cout<<""<<endl;
  159. cout<<""<<endl;
  160. cout<<" #####################################"<<endl;
  161. cout<<" ### ###"<<endl;
  162. cout<<" ### 1 - Colombo to Washington ###"<<endl;
  163. cout<<" ### 2 - Colombo to Paris ###"<<endl;
  164. cout<<" ### 3 - Colombo to London ###"<<endl;
  165. cout<<" ### ###"<<endl;
  166. cout<<" #####################################"<<endl;
  167. cout<<""<<endl;
  168. cout<<""<<endl;
  169. cout<<"Please select one of the above route numbers :-";
  170. cin>>routeno;
  171.  
  172.  
  173.  
  174.  
  175. }
  176.  
  177. double calticprice(){
  178.  
  179.  
  180. if(routeno==1){
  181.  
  182. tic=70000;
  183. }
  184.  
  185. else if (routeno==2){
  186.  
  187. tic=80000;
  188.  
  189. }
  190.  
  191. else if(routeno==3){
  192.  
  193. tic=50000;
  194. }
  195. return tic;
  196.  
  197. }
  198.  
  199. void calage(){
  200. double tic2=tic;
  201. if(age<=4){
  202. tic3=(tic2*50)/100;
  203. }
  204. else if((age>5)&&(age<=15)){
  205. tic3=(tic2*75)/100;
  206. }
  207.  
  208. else if((age>16)&&(age<18)){
  209.  
  210. tic3=(tic2*90)/100;
  211.  
  212. }
  213.  
  214. else{
  215.  
  216. tic3=tic2;
  217.  
  218. }
  219. }
  220.  
  221. void display(){
  222. system("cls");
  223. cout<<""<<endl;
  224. cout<<""<<endl;
  225. cout<<""<<endl;
  226.  
  227. cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
  228. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  229.  
  230. cout<<" TICKET DETAILS "<<endl;
  231. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  232.  
  233. cout<<"%%% NAME OF THE CUSTOMER :"<<name<<endl;
  234. cout<<""<<endl;
  235. cout<<""<<endl;
  236. cout<<"%%% AGE OF THE CUSTOMER :"<<age<<endl;
  237. cout<<""<<endl;
  238. cout<<""<<endl;
  239. cout<<"%%% NIC OF THE CUSTOMER :"<<idno<<endl;
  240. cout<<""<<endl;
  241. cout<<""<<endl;
  242. cout<<"%%% SEAT NUMBER OF THE CUTOMER :"<<seatnum<<endl;
  243. cout<<""<<endl;
  244. cout<<""<<endl;
  245. cout<<"THE FLIGHT NUMBER IS : FL110 "<<endl;
  246. cout<<""<<endl;
  247. cout<<""<<endl;
  248. cout<<"YOUR RESERVED DATE IS : 2009 10 28"<<endl;
  249. cout<<""<<endl;
  250.  
  251. if(selct==1){
  252. cout<<"TICKET PRICE :"<<tic3<<endl;
  253. }
  254. else if(selct==2){
  255. cout<<"TICKET PRICE :"<<tic5<<endl;
  256. }
  257. cout<<"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"<<endl;
  258.  
  259. }
  260.  
  261. void seatnum(){
  262. int seat;
  263. int seatnum=0;
  264.  
  265. cout<<""<<endl;
  266. cout<<""<<endl;
  267. cout<<""<<endl;
  268. cout<<"DETAILS OF YOUR TICKET HAS BEEN SUCCESSFULLY UPDATED TO OUR COMPANY "<<endl;
  269.  
  270. cout<<" FINALLY PLEASE ENTER THE SEAT NUMBER - ";
  271. cin>>seat;
  272. cout<<endl;
  273. if(seatnum!=seat){
  274. seatnum=seat;
  275. cout<<"SUCCESSFUL"<<endl;
  276. }
  277. else{
  278. cout<<"SORRY"<<endl;
  279. if(seatnum!=seat){
  280. seatnum=seat;
  281. cout<<"SUCCESSFUL"<<endl;
  282. }
  283. }
  284.  
  285. }
  286.  
  287. };
  288.  
  289. class economic:public passenger{
  290. public:
  291. void getdata(){
  292.  
  293. passenger::getdata();
  294.  
  295. }
  296.  
  297. void calticprice2(){
  298.  
  299. passenger::calticprice();
  300.  
  301.  
  302.  
  303.  
  304. }
  305.  
  306. void seatnum(){
  307. passenger::seatnum();
  308. }
  309.  
  310.  
  311. };
  312.  
  313.  
  314. class business:public passenger{
  315. public:
  316. void getdata(){
  317.  
  318. passenger::getdata();
  319.  
  320. }
  321.  
  322. void calticprice3(){
  323.  
  324. passenger::calticprice();
  325. double tic4=tic;
  326. if(age<=4){
  327. tic5=(tic4*123/100)*50/100;
  328. }
  329. else if((age>=5)&&(age<=15)){
  330. tic5=(tic4*123/100)*75/100;
  331. }
  332.  
  333. else if((age>16)&&(age<18)){
  334.  
  335. tic5=(tic4*123/100)*90/100;
  336.  
  337. }
  338.  
  339. else{
  340.  
  341. tic5=(tic4*123)/100;
  342.  
  343. }
  344.  
  345.  
  346. }
  347. void seatnum(){
  348. passenger::seatnum();
  349. }
  350.  
  351.  
  352. };
  353.  
  354. //void seatnum();
  355.  
  356.  
  357. int main(){
  358.  
  359. int menuselect;
  360. char c;
  361.  
  362. passenger p1;
  363. do{
  364. system("cls");
  365. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 10);
  366. cout<<"******************************************************************************"<<endl;
  367. cout<<"* *"<<endl;
  368. cout<<"* WELCOME TO THE TRAVEL LINE AIRLINE TRANSPORTATION COMPANY *"<<endl;
  369. cout<<"* *"<<endl;
  370. cout<<"* TICKET RESERVATION PROGRAM *"<<endl;
  371. cout<<"* *"<<endl;
  372. cout<<"* *"<<endl;
  373. cout<<"******************************************************************************"<<endl;
  374.  
  375.  
  376. cout<<""<<endl;
  377. cout<<""<<endl;
  378. cout<<""<<endl;
  379. cout<<""<<endl;
  380.  
  381. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 14);
  382. cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
  383. cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
  384. cout<<"~~~~~ MAIN MENU ~~~~"<<endl;
  385. cout<<"~~~~~ ~~~~"<<endl;
  386. cout<<"~~~~~ (1) Watch the prices ~~~~"<<endl;
  387. cout<<"~~~~~ ~~~~"<<endl;
  388. cout<<"~~~~~ (2) Reserve a ticket ~~~~"<<endl;
  389. cout<<"~~~~~ ~~~~"<<endl;
  390. cout<<"~~~~~ ~~~~"<<endl;
  391. cout<<"~~~~~ ~~~~"<<endl;
  392. cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
  393. cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
  394. cout<<""<<endl;
  395. cout<<""<<endl;
  396. cout<<""<<endl;
  397. SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), 15);
  398. cout<<""<<endl;
  399. cout<<""<<endl;
  400. cout<<""<<endl;
  401. cout<<""<<endl;
  402. cout<<"Please select one of the above selections :-";
  403. cin>>menuselect;
  404.  
  405. if(menuselect==1){
  406. system("cls");
  407. p1.ticketprice();
  408. cout<<""<<endl;
  409. cout<<""<<endl;
  410. cout<<""<<endl;
  411. cout<<""<<endl;
  412. cout<<"do u want to Reserve a ticket(y/n)";
  413. cin>>c;
  414. if(c=='y')
  415. {
  416. system("cls");
  417. p1.getdata();
  418. p1.calticprice();
  419. p1.calage();
  420. p1.seatnum();
  421. p1.display();
  422.  
  423. }
  424.  
  425. else if(c=='n'){
  426.  
  427. cout<<"Thank you Very much for using our travelline ticket reservation program good bye"<<endl;
  428. system("cls");
  429. }
  430.  
  431. }
  432. else if(menuselect==2){
  433. system("cls");
  434. if(selct=1){
  435. //case 1:
  436. economic e1;
  437. e1.getdata();
  438. e1.calticprice2();
  439. e1.calage();
  440. e1.seatnum();
  441. e1.display();
  442.  
  443. //break;
  444. }
  445. else if(selct=2){
  446. business b1;
  447. b1.getdata();
  448. b1.calticprice3();
  449. b1.calage();
  450.  
  451. b1.seatnum();
  452. b1.display();
  453. //break;
  454. }
  455. else{
  456. cout<<"Invalid selection"<<endl;
  457. }
  458. //}
  459. //else if(select==2){
  460.  
  461.  
  462. }
  463. cout<<"DO U WANT TO CONTINUE?(y/n) ";
  464. cin>>ch;
  465. }while(ch!='n');
  466.  
  467.  
  468. return 0;
  469.  
  470.  
  471. }
Then what is EXACT question do you want us to help. Your code is too long and I need some time just to see it. and Lol, I'm at work
Atheist: God is man made imagination, he doesn't exist!
Theist: It's okay, can you imagine anything else that doesn't exist?
Junior MD --- Python, C++ and PHP
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 1,968
Reputation: tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute 
Solved Threads: 214
tux4life's Avatar
tux4life tux4life is offline Offline
Posting Virtuoso

Re: C++ URGENT HELP PLZ PLZ PLZ help me

 
0
  #8
Jul 26th, 2009
To the OP:

Can't you read? You were asked to use code tags, but what do you do? You just continue to not use them, don't expect much help then.

Information about code tags is found all over the website:
1) in the Rules you were asked to read when you registered
2) in the text at the top of this forum
3) in the announcement at the top of this forum titled Please use BB Code and Inlinecode tags
4) in the sticky post above titled Read Me: Read This Before Posting
5) any place CODE tags were used
6) Even on the background of the box you actually typed your message in!
How can you miss these? You have no excuse for not using them.

Your begging and begging and begging is really getting on my nerves, it won't get you anywhere, already bothered to even look at the links in Salem's post? Wait... Let me guess: no. And let me guess again for the reason: you didn't see any code in his post.
You're just another one who just wants us to fix up your screwed code.
Do you really think that we're going fix the code for you? We've better things to do, for example helping people who deserve help, in other words, helping people who are not like you.

To help you I'll give you one magical link which will help you to write code which actually works, here it is...
Last edited by tux4life; Jul 26th, 2009 at 6:19 am. Reason: fix some typos, make post enjoyable to read
"Never argue with idiots, they just drag you down to their level and then beat you with experience."
Reply With Quote Quick reply to this message  
Join Date: Feb 2004
Posts: 10,057
Reputation: crunchie is a splendid one to behold crunchie is a splendid one to behold crunchie is a splendid one to behold crunchie is a splendid one to behold crunchie is a splendid one to behold crunchie is a splendid one to behold crunchie is a splendid one to behold 
Solved Threads: 762
Moderator
Featured Poster
crunchie's Avatar
crunchie crunchie is offline Offline
Spyware Killer

Re: C++ URGENT HELP PLZ PLZ PLZ help me

 
0
  #9
Jul 26th, 2009
In addition to what tux4life has said, do not use chatroom speak. Use correct, complete English words and sentences as per the forum rules.
Thank you.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC