Code
Code
#include <vector>
#include <string>
#include <map>
#include <iomanip>
int day = 0;
int period = 0;
while (!subjectList.empty()) {
for (auto it = subjectList.begin(); it != subjectList.end(); ) {
timetable[day][period] = it->first;
if (--it->second == 0) {
it = subjectList.erase(it);
} else {
++it;
}
period = (period + 1) % periodsPerDay;
if (period == 0) {
day = (day + 1) % DAYS_IN_WEEK;
}
}
}
return timetable;
}
int main() {
int numSubjects;
std::cout << "Enter the number of subjects: ";
std::cin >> numSubjects;
int periodsPerDay;
std::cout << "Enter the number of periods per day: ";
std::cin >> periodsPerDay;
return 0;
}