Thanks for the suggestions. I've modified the script a bit.
Code:
#include <iostream>
#include <string>
using namespace std;
int main (int argc, char *argv[])
{
string economy_input;
int input;
int seats[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int size = sizeof(seats) / sizeof(int);
for (int i = 0; i < size; i++)
{
cout << "Please type in 1 for \"First Class\" or 2 for \"Economy\"" << endl;
cin >> input;
if (input == 1)
{
if (seats[i] == 0)
{
seats[i] = 1;
cout << "Assigning the person's seat to: " << i << " in the first class section." << endl;
}
else
{
cout << "All of the first class spaces have been filled. Would you like to go to economy? Yes or No" << endl;
getline(cin,economy_input);
if (economy_input == "No")
{
cout << "Next flight leaves in 3 hours." << endl;
}
}
}
if (input == 2)
{
seats[i] = 1;
cout << "Assigning the person's seat to: " << i << " in the economy section." << endl;
}
}
return 0;
}
I changed it to a single array since the problem is asking for a single-subscripted array.
My problem is that I don't know how to mark the elements to 1. First Class is seats 1-5 and Economy is 6-10. So if a person types in 2, then element 6 in the array should be set to 1. That's the part that I don't know how to do. The same would go with First Class.