[prog] C++

wolf wolf at wolfrising.net
Tue Jan 20 08:49:10 EST 2004


Hi, I have a sample program from a book I've been working on and I have 
it to a point where it
compiles without errors and runs. However, it fails to print the part 
about having to wait
three hours for the next flight.  I was wondering if anyone might see 
the mistake I've made
that is causing the program to skip over this part? Also, any 
suggestions for improvement
are welcome as always : )

Thanks : )

#include <iostream>

#include <cctype>

using namespace std;

int main()

{
	
	int seat [10] = {NULL};
	
	int first_class = 0;
	
	int economy = 5;
	
	char Choice;
	
	int i = 0;
	
	
	
	
	
	
	
	cout << "Please enter 1 for First Class or enter 2 for Economy: ";
	
	cin    >> Choice;
	
	cout << endl;
	
	if (Choice = 1)
		
		
		
		switch (Choice)
			
		{
			
			case 1:
				
				cout << "Your choice is 1.";
				
				break;
				
			case 2:
				
				cout << "Your choice is 2.";
				
				break;
				
			default:
				
				cout << "Next flight leaves in 3 hours." << endl;
				
		}
			
			
			
			for ( i =0; i < 5; i++)
				
			{
				
				cout << "Your assigned seat is: \t" << i << endl;
				
				first_class++;
				
				
				
				if (seat [4] = 1)
					
					cout << endl;
				
				cout << "This section is full. Would you like to be assigned to";
				
				cout << " the economy section?" << endl;
				
				cout << endl;
				
			}
			
			for (i = 5; i < 9; i ++)
				
			{
				
				cout << endl;
				
				cout <<" Your assigned seat is: " << i <<  endl;
				
				economy++;
				
				
				
				if (seat [9] = 1)
					
					cout << endl;
				
				cout << "This section is full.  Would you like to be assigned to ";
				
				cout << "the economy section?" << endl;
				
			}
			
			return 0;
	
}







	
	
	
	
	
	
	


More information about the Programming mailing list