Having trouble getting this code to print 1 seat then loop back to user prompt. it should loop back until the seats are filled then display first class/ecoomy full. this is the code i have so far.
int main(int argc, char** argv) {
const int firstClass[] = {1, 2, 3, 4}; //first class array list
const int economyClass[] = {5, 6, 7, 8, 9, 10, 11, 12}; //economy array list
int firstLen = 4; // first class length
int economyLen = 8; //economy class length
int userInput;
int i;
//user prompt
printf("Please type 1 for First Class\n");
printf("Please type 2 for Economy\n");
printf("Please type 0 to Quit\n");
printf("\n");
scanf("%d", &userInput); // scanning for user input
if(userInput == 1){
for(i = 0; i < 4; i++){
if(i < firstLen){
printf("Class: First Seat Number: %d\n", firstClass[i]);
}
else{
printf("First Class is Full. Next flight is tomorrow.");
}
}
}
if(userInput == 2){
for (i = 0; i < 8; i++){
if(i < economyLen){
printf("Class: Economy Seat Number: %d\n", economyClass[i]);
}
else{
printf("Economy is Full. Next flight is tomorrow.");
}
}
}
}