| | |
Please help in this program array
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
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 |
api array based binary bitmap c++ c/c++ calculator char char* class classes code coding compile console conversion count database delete deploy desktop developer directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp iamthwee ifstream input int java lib linkedlist linker linux list loop looping loops map math matrix memory multiple news node number numbertoword output pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






