Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
int Time[8] = { 8,9,10,11,12,2,3,4 };
string Day[6] = { "Monday","Tuesday","Wednesday","Thursday","Friday","Saturday" };
string Monday[8] = { "4001CEM","4002CEM","4003CEM","4004CEM","4005CEM","4006CEM","4007CEM","4008CEM" };
string Tuesday[8] = { "4004CEM","4003CEM","4002CEM","4001CEM","4008CEM","4006CEM","4007CEM","4005CEM" };
string Wednesday[8] = { "4001CEM","4007CEM","4003CEM","4004CEM","4005CEM","4006CEM","4002CEM","4008CEM" };
string Thursday[8] = { "4002CEM","4001CEM","4003CEM","4004CEM","4005CEM","4008CEM","4007CEM","4006CEM" };
string Friday[8] = { "4008CEM","4002CEM","4003CEM","4004CEM","4005CEM","4006CEM","4007CEM","4001CEM" };
string Saturday[8] = { "4001CEM","4005CEM","4003CEM","4004CEM","4002CEM","4006CEM","4007CEM","4008CEM" };
string Lecturers[8] = { "Mr Brown","Ms Green","Mr Wilson","Mrs Stone","Mr Beckham","Mrs Williams","Mr Jones","Ms Davis" };
string Classes[8] = { "A","B","C","D","E","F","G","H" };
string Rooms[8] = { "20","22","10","8","5","4","7","15" };
int main()
{
int time;
string day;
cout << "Enter the time: " << endl;
cin >> time;
cout << "Enter the day: ";
cin >> day;
bool boolday = false;
bool booltime = false;
int timesub = 0;
int daysub = 0;
for (timesub = 0; timesub < 8; timesub++)
{
if (Time[timesub] == time)
{
booltime = true;
break;
}
}
for (daysub = 0; daysub < 6; daysub++)
{
if (Day[daysub] == day)
{
boolday = true;
break;
}
}
if (!boolday || !booltime)
{
cout << " No class found for that time and day \n";
_getch();
return 0;
}
string activity;
string next;
switch (daysub)
{
case 0: activity = Monday[timesub];
if (timesub < 7) next = Monday[timesub + 1]; break;
case 1: activity = Tuesday[timesub];
if (timesub < 7) next = Tuesday[timesub + 1]; break;
case 2: activity = Wednesday[timesub];
if (timesub < 7) next = Wednesday[timesub + 1]; break;
case 3: activity = Thursday[timesub];
if (timesub < 7) next = Thursday[timesub + 1]; break;
case 4: activity = Friday[timesub];
if (timesub < 7) next = Friday[timesub + 1]; break;
case 5: activity = Saturday[timesub];
if (timesub < 7) next = Saturday[timesub + 1]; break;
default: activity = "Day Not found "; break;
}
cout << "These are your classes on " << day << " \n" << activity << " " << Lecturers[timesub] << " " << Classes[timesub] << " " << Rooms[timesub] << "\n";
cout << next << " " << Lecturers[timesub+1] << " " << Classes[timesub+1] << " " << Rooms[timesub+1] << '\n';
_getch();
}