Please help in this program array

Reply

Join Date: Jan 2008
Posts: 21
Reputation: CE Student is an unknown quantity at this point 
Solved Threads: 0
CE Student CE Student is offline Offline
Newbie Poster

Please help in this program array

 
0
  #1
Jan 18th, 2008
Hi!
I am a new member here
and I want any body to help me in this program
becuase I am a new student in c++
and I don not now a lot in it
sorry for my wrong language, because I do not speak English very will
please help me
I should sent this program tomorow



(Airplane Seating Assignment) Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with 6 seats in each row. Rows 1 and 2 are first class; the remaining rows are economy class. Also, rows 1 through 7 are nonsmoking. Your program must prompt the user to enter the following information:
Ticket type (first class or economy class) For economy class, the smoking or nonsmoking section Desired seat Output the seating plan in the following form:

A B C D E F
Row 1 * * X * X X
Row 2 * X * X * X
Row 3 * * X X * X
Row 4 X * X * X X
Row 5 * X * X * *
Row 6 * X * * * X
Row 7 X * * * X X
Row 8 * X * X X *
Row 9 X * X X * X
Row 10 * X * X X X
Row 11 * * X * X *
Row 12 * * X X * X
Row 13 * * * * X *

Here , * indicates that the seat is available; X indicated that the seat is occupied. Make this a menu-driven program; show the user’s choices and allow the user to make the appropriate choice.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 21
Reputation: CE Student is an unknown quantity at this point 
Solved Threads: 0
CE Student CE Student is offline Offline
Newbie Poster

Re: Please help in this program array

 
0
  #2
Jan 18th, 2008
This is my try
  1. #include<iostream>
  2. #include<string>
  3. #include<fstream>
  4. using namespace std;
  5. int main()
  6. {
  7. string nameofstd[50];//name of student
  8. double stdtestscore[50];//student test score
  9. double sum=stdtestscore[0];
  10. double larger=stdtestscore[0];
  11. int M;
  12. double avg;
  13. int counter=0;
  14. ifstream infile;
  15. infile.open("in.txt");
  16. while(!infile.eof() && counter<=50)
  17. {
  18. infile>>nameofstd[counter]>>stdtestscore[counter];
  19. counter++;
  20. }
  21. counter--;
  22. for(int i=0;i<counter;i++)
  23. {
  24. sum+=stdtestscore[i];
  25. M=0;
  26. if(stdtestscore[i]>larger)
  27. {
  28. larger=stdtestscore[i];
  29. M=i;
  30. }
  31. }
  32.  
  33. avg=sum/counter;
  34.  
  35. cout<<"average="<<avg<<endl;
  36.  
  37. cout<<"The students thier test scores are below the class average"<<endl;//an appropriate message
  38. cout<<"students are:"<<endl;
  39. for(int Z=0;Z<counter;Z++)
  40. {
  41. if(stdtestscore[Z]<avg)
  42. cout<<nameofstd[Z]<<endl;
  43. }
  44. cout<<"The Highest test score is:"<<larger<<endl;
  45. cout<<"The student whose have the highest test score are:"<<endl;
  46.  
  47. for(int A=0;A<counter;A++)
  48. {
  49. if(stdtestscore[A]==larger)
  50. cout<<nameofstd[A]<<endl;
  51. }
  52. infile.close();
  53. return 0;
  54. }
Last edited by Narue; Jan 18th, 2008 at 1:52 pm. Reason: Added code tags
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 21
Reputation: CE Student is an unknown quantity at this point 
Solved Threads: 0
CE Student CE Student is offline Offline
Newbie Poster

Re: Please help in this program array

 
0
  #3
Jan 18th, 2008
There is any thing wrong??????
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,540
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 704
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: Please help in this program array

 
0
  #4
Jan 18th, 2008
>There is any thing wrong??????
Yes, you forgot to add code tags despite having instructions thrown in your face with every post. I've added them for you this time.
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 21
Reputation: CE Student is an unknown quantity at this point 
Solved Threads: 0
CE Student CE Student is offline Offline
Newbie Poster

Re: Please help in this program array

 
0
  #5
Jan 19th, 2008
Why there is no answer
please help me
This pogram 100 mark for it
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 6
Reputation: smile! is an unknown quantity at this point 
Solved Threads: 0
smile! smile! is offline Offline
Newbie Poster

Re: Please help in this program array

 
0
  #6
Jan 19th, 2008
Hello!
How we can help you and your program that you trid to did it is different and the program question is differint !
your program about airplain and your program about students and scores!
Reply With Quote Quick reply to this message  
Join Date: Dec 2005
Posts: 5,851
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

Re: Please help in this program array

 
0
  #7
Jan 19th, 2008
> double sum=stdtestscore[0];
What will the value of sum be before you've read data into stdtestscore[0]?
What will the value of sum be AFTER you've read data into stdtestscore[0]?

> while(!infile.eof() && counter<=50)
If counter is 50, will that overflow your array?

And smile! is correct, your question and your answer have no relationship.
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