[prog] Re: C++
wolf
wolf at wolfrising.net
Tue Jan 20 11:08:17 EST 2004
It's not doing quite what it's supposed to but here's the modified
version based on everyone's
suggestions so far : ) It's most definitely better than it was before
: ) Thanks!
#include <iostream>
#include <cctype>
using namespace std;
int main()
{
int seat [10];
int first_class = 0;
int economy = 5;
int Choice;
int i = 0;
int option;
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:
}
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? (Y or N)" << 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? Enter 1 for yes, 2 for no: " ;
cin >> option;
//if (option == 1)
switch (option)
{
case 1:
cout << "Your choice is Y. ";
break;
case 2:
cout << "Your choice is N. ";
break;
//default:
}
}
cout << "Next flight leaves in 3 hours." << endl;
return 0;
}
More information about the Programming
mailing list