[prog] Re: C++

Kathryn Andersen kat_lists at katspace.com
Wed Jan 21 10:16:42 EST 2004


On Tue, Jan 20, 2004 at 10:31:31AM -0500, wolf wrote:
[snippage]
> 
> and now the code : )
> 
> 
> #include <iostream>
> 
> #include <cctype>
> 
> using namespace std;
> 
> int main()
> 
> {
> 	
> 	int seat [10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
> 	
> 	int first_class = 0;
> 	
> 	int economy = 5;
> 	
> 	char Choice;
> 	
> 	int i = 0;
> 	
> 	char option;
> 	
> 	
> 	
> 	
> 	
> 	
> 	
> 	cout << "Please enter 1 for First Class or enter 2 for Economy: ";
> 	
> 	cin    >> Choice;
> 	
> 	cout << endl;
> 	
> 	if (Choice == 1)

There is still no reason for this if statement.
You are using the switch below, you don't need this IF.
 		
> 		switch (Choice)
> 			
> 		{
> 			
> 			case '1':
> 				
> 				cout << "Your choice is 1.";
> 				
> 				break;
> 	
> 				
> 			case '2':
> 				
> 				cout << "Your choice is 2.";
> 				
> 				break;
> 				
> 		//	default:
> 				
> 								
> 		}

Other people have commented on other parts of this, I just wanted to
point that out...

-- 
 _--_|\     | Kathryn Andersen	<http://www.katspace.com>
/      \    | 
\_.--.*/    | GenFicCrit mailing list <http://www.katspace.com/gen_fic_crit/>
      v     | 
------------| Melbourne -> Victoria -> Australia -> Southern Hemisphere
Maranatha!  |	-> Earth -> Sol -> Milky Way Galaxy -> Universe


More information about the Programming mailing list