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.

Recommended Answers

All 6 Replies

This is my try

#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;
}

There is any thing wrong??????

>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.

Why there is no answer
please help me
This pogram 100 mark for it
:(

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!

> 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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.