//a program to assign seats on each flight of the airlines’ only plane (capacity 25 seats)
#include <iostream>

using std::cout;
using std::endl;
using std::cin;
#include<string>

int main()
{
	string Name;
	string idNumber;
	const int SEATS = 26;
    int plane[ SEATS ] = { 0 }, people = 0, economy = 14, firstClass = 1;
    char response, choice,F = firstClass,E = economy;
	
	while ( people < 25 ) {
		cout << "\nPlease type \"F\" for \"firstClass\" OR \"E\" for \"economy\"\n";
		cin >> choice;
		cout<<" Enter your name "<<endl;
		getline( cin,Name,'\n');
		cout<<"Enter your id number"<<endl;
		cin>>idNumber;
		
		if ( choice == 'F' ) {
			if ( !plane[ firstClass ] && firstClass <= 13 ) {
				cout << "Your seat assignment is " << firstClass << ' ';
				plane[ firstClass++ ] = 1;
				++people;
			}
		}
		if( choice == 'E'){
			if ( !plane[ economy ] && economy <= 25 ) {
				cout << "Your seat assignment is " << economy << '\n';
				plane[ economy++ ] = 1;
				++people;
			}
		}
			else if ( firstClass > 13 && economy <= 25 ) {
				cout << "The firstClass section is full.\n"
					<< "Would you like to sit in the economy"
					<< " section (Y or N)? ";
				cin >> response;
				if( response  == 'Y' ) {
					cout << "Your seat assignment is " << economy << ' ';
					plane[ economy++ ] = 1;
					++people;
				}
				else
					cout << "The plane is full!! Next flight leaves in 5 Hours Time.\n";
			}
			if ( economy > 25 && firstClass <= 13 ) {
				cout << "The economy section is full.\n"
					<< "Would you like to sit in the firstClass"
					<< " section (Y or N)? ";
				cin >> response;
				
				if (response == 'Y' ) {
					cout << "Your seat assignment is " << firstClass << '\n';
					plane[ firstClass++ ] = 1;
					++people;
				}
				else
					cout << "The plane is full!! Next flight leaves in 5 Hours Time.\n";
				}
	}
	cout << "The plane is full!! Next flight leaves in 5 Hours Time.\n";
	cout << "All seats for this flight are sold." << endl;
	return 0;
}

The string class is in namespace std too. In fact, every standard name is in the std namespace.

It would help if you told us the problem that you're having, though in this case it is easy to guess. The reason that it doesn't recognize the string class is because string is in the std namespace, just like the <iostream> objects. You need to have a using std::string; statement, or else explicitly reference the namespace in the declarations. Given that there are only two such declarations, the explicit route may be better:

std::string Name;
    std::string idNumber;

Now, that's not the only problem I see (hint: use cin.ignore() after the >> operator), but that's the one preventing compilation.

This article has been dead for over six months. Start a new discussion instead.