| | |
Please help in this program array
![]() |
•
•
Join Date: Jan 2008
Posts: 21
Reputation:
Solved Threads: 0
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.
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.
•
•
Join Date: Jan 2008
Posts: 21
Reputation:
Solved Threads: 0
This is my try
C++ Syntax (Toggle Plain Text)
#include<iostream> #include<string> #include<fstream> using namespace std; int main() { string nameofstd[50];//name of student double stdtestscore[50];//student test score double sum=stdtestscore[0]; double larger=stdtestscore[0]; int M; double avg; int counter=0; ifstream infile; infile.open("in.txt"); while(!infile.eof() && counter<=50) { infile>>nameofstd[counter]>>stdtestscore[counter]; counter++; } counter--; for(int i=0;i<counter;i++) { sum+=stdtestscore[i]; M=0; if(stdtestscore[i]>larger) { larger=stdtestscore[i]; M=i; } } avg=sum/counter; cout<<"average="<<avg<<endl; cout<<"The students thier test scores are below the class average"<<endl;//an appropriate message cout<<"students are:"<<endl; for(int Z=0;Z<counter;Z++) { if(stdtestscore[Z]<avg) cout<<nameofstd[Z]<<endl; } cout<<"The Highest test score is:"<<larger<<endl; cout<<"The student whose have the highest test score are:"<<endl; for(int A=0;A<counter;A++) { if(stdtestscore[A]==larger) cout<<nameofstd[A]<<endl; } infile.close(); return 0; }
Last edited by Narue; Jan 18th, 2008 at 1:52 pm. Reason: Added code tags
> 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.
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.
![]() |
Similar Threads
- Factorial program using an array. (C)
- Problem on array based list (C)
- Need help starting program using vector (C++)
- question about array (C++)
- Array without twice the same number? (C)
- How do I create a program using an Array ? (C++)
- Using an Array to declare multiple bitmap handlers (C)
Other Threads in the C++ Forum
- Previous Thread: C++ Calculating even Values Problem
- Next Thread: C++ (Could someone can help me?)
| Thread Tools | Search this Thread |
action api array auto based beginner binary bitmap c++ c/c++ calculator challenge char class classes code coding compile console conversion count createcopyofanyfileinc delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game garbage givemetehcodez graph gui hmenu homeworkhelp homeworkhelper iamthwee ifstream input insert int integer java lib linkedlist linker loop looping loops map math matrix memory multiple news node noob output parameter pointer primenumbersinrange problem program programming project python random read recursion reference rpg sockets string strings temperature template test text text-file tree url variable vector video win32 windows winsock wordfrequency wxwidgets






