When I run this segment of my program, the only loop to work is the last for loop involving the ‘week’ variable.
cout << "Enter Building: ";
cin >> building;
cout << "\n";
cout << "Enter Room: ";
cin >> room;
cout << "\n";
cout << "Enter Numeric Month: ";
cin >> monthIndex;
monthIndex = monthIndex - 1;
cout << "\n";
cout << "Enter Week: ";
cin >> week;
cout << "\n";
for (;building <= 30; building++)
{
for (;room <= 24; room++)
{
for (;monthIndex <= 11; monthIndex++)
{
for (;week <= 4; week++)
{
cout << "Building: " << building << "\n";
cout << "Room: " << room << "\n";
cout << "Month: " << month[monthIndex] << "\n";
cout << "Week: " << week << "\n\n";
}
}
}
}
Example output:
Press 1 to print all of the ticket books
Press 2 to print a specific ticket book
Press 3 to exit the program
2 menu selection
Enter Building: 26
Enter Room: 20
Enter Numeric Month: 8
Enter Week: 2
Building: 26
Room: 20
Month: August
Week: 2
Building: 26
Room: 20
Month: August
Week: 3
Building: 26
Room: 20
Month: August
Week: 4
You need to set
weekto1at the end of last inner mostforloop.