Permalink
Cannot retrieve contributors at this time
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?
resit-group-project-sem-2/updated 4007 FInal resit.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
689 lines (616 sloc)
28.7 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
#include <string> | |
#include<stdlib.h> | |
#include<time.h> | |
int main() | |
{ | |
string lecturer_names[5] = { "AA","BB","CC","DD","EE"}; | |
string module_names[5] = { "1001","1002","1003","1004","1005"}; | |
string student_names[10] = {"1","2","3","4","5","6","7","8","9","10"}; | |
string classes_names[11] ={ "1001a","1001b","1002a","1002b","1003a","1003b","1004a","1004b","1005a","1005b"}; | |
string room_names[5] = {"room_a","room_b","room_c","room_d", "room_e"}; | |
string week_day[5] = {"monday","tuesday","wednesday","thursday","friday"}; | |
string period_number[2]{"9.00 am -12.00 pm","1.00pm-4.00pm"}; | |
int i = 0; | |
label1: | |
cout<<"what would you like to find in the database\n please choose either\nmodule\nclasses\nlecturer\nrooms\nstudent\ntimetable"<<endl; | |
string response_1; | |
cin>>response_1; | |
if(response_1 == "module" ) | |
{ | |
cout<<"what module would you like to know more about\n 1001,1002,1003,1004,1005"<<endl; | |
string response_2; | |
cin>>response_2 ; | |
if(response_2 == module_names[0]) | |
{ | |
cout<<"lecturer name:"<<lecturer_names[0]<<"\n"; | |
cout<<"student name:"<<student_names[0,1]<<"\n"; | |
cout<<"class names:"<<classes_names[0,1]<<"\n"; | |
cout<<"room name:"<<room_names[0]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == module_names[1]) | |
{ | |
cout<<"lecturer name:"<<lecturer_names[1]<<"\n"; | |
cout<<"student name:"<<student_names[2,3]<<"\n"; | |
cout<<"class names:"<<classes_names[2,3]<<"\n"; | |
cout<<"room name:"<<room_names[1]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == module_names[2]) | |
{ | |
cout<<"lecturer name:"<<lecturer_names[2]<<"\n"; | |
cout<<"student name:"<<student_names[4,5]<<"\n"; | |
cout<<"class names:"<<classes_names[4,5]<<"\n"; | |
cout<<"room name:"<<room_names[2]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == module_names[3]) | |
{ | |
cout<<"lecturer name:"<<lecturer_names[3]<<"\n"; | |
cout<<"student name:"<<student_names[6,7]<<"\n"; | |
cout<<"class names:"<<classes_names[6,7]<<"\n"; | |
cout<<"room name:"<<room_names[3]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == module_names[4]) | |
{ | |
cout<<"lecturer name:"<<lecturer_names[4]<<"\n"; | |
cout<<"student name:"<<student_names[7,8]<<"\n"; | |
cout<<"class names:"<<classes_names[7,8]<<"\n"; | |
cout<<"room name:"<<room_names[4]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
} | |
if(response_1 == "classes" ) | |
{ | |
cout<<"what class would you like to know more about\n 1001a,1001b,1002a,1002b,1003a,1003b,1004a,1004b,1005a,1005b"<<endl; | |
string response_2; | |
cin>>response_2; | |
if(response_2 == classes_names[0,1]) | |
{ | |
cout<<"lecturer name:"<<lecturer_names[0]<<"\n"; | |
cout<<"student name:"<<student_names[0,1]<<"\n"; | |
cout<<"module names:"<<module_names[0]<<"\n"; | |
cout<<"room name:"<<room_names[0]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == classes_names[2,3]) | |
{ | |
cout<<"lecturer name:"<<lecturer_names[1]<<"\n"; | |
cout<<"student name:"<<student_names[2,3]<<"\n"; | |
cout<<"module names:"<<module_names[1]<<"\n"; | |
cout<<"room name:"<<room_names[1]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == classes_names[4,5]) | |
{ | |
cout<<"lecturer name:"<<lecturer_names[2]<<"\n"; | |
cout<<"student name:"<<student_names[4,5]<<"\n"; | |
cout<<"module names:"<<module_names[2]<<"\n"; | |
cout<<"room name:"<<room_names[2]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == classes_names[6,7]) | |
{ | |
cout<<"lecturer name:"<<lecturer_names[3]<<"\n"; | |
cout<<"student name:"<<student_names[6,7]<<"\n"; | |
cout<<"module names:"<<module_names[3]<<"\n"; | |
cout<<"room name:"<<room_names[3]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == classes_names[8,9]) | |
{ | |
cout<<"lecturer name:"<<lecturer_names[4]<<"\n"; | |
cout<<"student name:"<<student_names[8,9]<<"\n"; | |
cout<<"module names:"<<module_names[4]<<"\n"; | |
cout<<"room name:"<<room_names[4]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
} | |
if(response_1 == "lecturer" ) | |
{ | |
cout<<"what lecturer would you like to know more about\n AA,BB,CC,DD,EE"<<endl; | |
string response_2; | |
cin>>response_2; | |
if(response_2 == lecturer_names[0]) | |
{ | |
cout<<"classes name:"<<classes_names[0,1]<<"\n"; | |
cout<<"student name:"<<student_names[0,1]<<"\n"; | |
cout<<"module names:"<<module_names[0]<<"\n"; | |
cout<<"room name:"<<room_names[0]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == lecturer_names[1]) | |
{ | |
cout<<"classes name:"<<classes_names[2,3]<<"\n"; | |
cout<<"student name:"<<student_names[2,3]<<"\n"; | |
cout<<"module names:"<<module_names[1]<<"\n"; | |
cout<<"room name:"<<room_names[1]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == lecturer_names[2]) | |
{ | |
cout<<"classes name:"<<classes_names[4,5]<<"\n"; | |
cout<<"student name:"<<student_names[4,5]<<"\n"; | |
cout<<"module names:"<<module_names[2]<<"\n"; | |
cout<<"room name:"<<room_names[2]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == lecturer_names[3]) | |
{ | |
cout<<"classes name:"<<classes_names[6,7]<<"\n"; | |
cout<<"student name:"<<student_names[6,7]<<"\n"; | |
cout<<"module names:"<<module_names[3]<<"\n"; | |
cout<<"room name:"<<room_names[3]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == lecturer_names[4]) | |
{ | |
cout<<"classes name:"<<classes_names[8,9]<<"\n"; | |
cout<<"student name:"<<student_names[8,9]<<"\n"; | |
cout<<"module names:"<<module_names[4]<<"\n"; | |
cout<<"room name:"<<room_names[4]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
} | |
if(response_1 == "rooms" ) | |
{ | |
cout<<"what room would you like to know more about\n room_a,room_b,room_c,room_d,room_e"<<endl; | |
string response_2; | |
cin>>response_2; | |
if(response_2 == room_names[0]) | |
{ | |
cout<<"classes name:"<<classes_names[0,1]<<"\n"; | |
cout<<"student name:"<<student_names[0,1]<<"\n"; | |
cout<<"module names:"<<module_names[0]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[0]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == room_names[1]) | |
{ | |
cout<<"classes name:"<<classes_names[2,3]<<"\n"; | |
cout<<"student name:"<<student_names[2,3]<<"\n"; | |
cout<<"module names:"<<module_names[1]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[1]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == room_names[2]) | |
{ | |
cout<<"classes name:"<<classes_names[4,5]<<"\n"; | |
cout<<"student name:"<<student_names[4,5]<<"\n"; | |
cout<<"module names:"<<module_names[2]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[2]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == room_names[3]) | |
{ | |
cout<<"classes name:"<<classes_names[6,7]<<"\n"; | |
cout<<"student name:"<<student_names[6,7]<<"\n"; | |
cout<<"module names:"<<module_names[3]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[3]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == room_names[4]) | |
{ | |
cout<<"classes name:"<<classes_names[8,9]<<"\n"; | |
cout<<"student name:"<<student_names[8,9]<<"\n"; | |
cout<<"module names:"<<module_names[4]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[4]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
} | |
if(response_1 == "student" ) | |
{ | |
cout<<"what student would you like to know more about\n 1,2,3,4,5,6,7,8,9,10"<<endl; | |
string response_2; | |
cin>>response_2; | |
if(response_2 == student_names[0]) | |
{ | |
cout<<"classes name:"<<classes_names[0,1]<<"\n"; | |
cout<<"room names:"<<room_names[0]<<"\n"; | |
cout<<"module names:"<<module_names[0]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[0]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == student_names[1]) | |
{ | |
cout<<"classes name:"<<classes_names[0,1]<<"\n"; | |
cout<<"room names:"<<room_names[0]<<"\n"; | |
cout<<"module names:"<<module_names[0]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[0]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == student_names[2]) | |
{ | |
cout<<"classes name:"<<classes_names[2,3]<<"\n"; | |
cout<<"room names:"<<room_names[1]<<"\n"; | |
cout<<"module names:"<<module_names[1]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[1]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == student_names[3]) | |
{ | |
cout<<"classes name:"<<classes_names[2,3]<<"\n"; | |
cout<<"room names:"<<room_names[1]<<"\n"; | |
cout<<"module names:"<<module_names[1]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[1]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == student_names[4]) | |
{ | |
cout<<"classes name:"<<classes_names[4,5]<<"\n"; | |
cout<<"room names:"<<room_names[2]<<"\n"; | |
cout<<"module names:"<<module_names[2]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[2]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == student_names[5]) | |
{ | |
cout<<"classes name:"<<classes_names[4,5]<<"\n"; | |
cout<<"room names:"<<room_names[2]<<"\n"; | |
cout<<"module names:"<<module_names[2]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[2]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == student_names[6]) | |
{ | |
cout<<"classes name:"<<classes_names[6,7]<<"\n"; | |
cout<<"room names:"<<room_names[3]<<"\n"; | |
cout<<"module names:"<<module_names[3]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[3]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>> response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == student_names[7]) | |
{ | |
cout<<"classes name:"<<classes_names[6,7]<<"\n"; | |
cout<<"room names:"<<room_names[3]<<"\n"; | |
cout<<"module names:"<<module_names[3]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[3]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == student_names[8]) | |
{ | |
cout<<"classes name:"<<classes_names[8,9]<<"\n"; | |
cout<<"room names:"<<room_names[4]<<"\n"; | |
cout<<"module names:"<<module_names[4]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[4]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
if(response_2 == student_names[9]) | |
{ | |
cout<<"classes name:"<<classes_names[8,9]<<"\n"; | |
cout<<"room names:"<<room_names[4]<<"\n"; | |
cout<<"module names:"<<module_names[4]<<"\n"; | |
cout<<"lecturer names:"<<lecturer_names[4]<<"\n"; | |
cout<<"if you wish to start again type 'yes' if not click anything else"<<endl; | |
string response_3; | |
cin>>response_3; | |
if(response_3 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
} | |
} | |
if(response_1 == "timetable"){ | |
//cout<<"test"<<endl; | |
//label: | |
while(i<5){ | |
if(i == 0){ | |
//cout<<week_day[i]<<"---> "; | |
} | |
for(int j=0;j<3;j++){ | |
// if(i==4 && j==1){ | |
// cout<<" "; | |
// } | |
if(j== 0){ | |
cout<<week_day[i]<<" "<<period_number[j]<<" "<<module_names[i]<<" "<<lecturer_names[i]<<" "<<room_names[i]<<" "<<student_names[i]<<" |"; //2(i)-1 didnt work in the format | |
//goto label3; | |
}else if(j== 1){ | |
cout<<week_day[i]<<" "<<period_number[j]<<" "<<module_names[i]<<" "<<lecturer_names[i]<<" "<<room_names[i]<<" "<<student_names[ i]<<" |"; //2(i) didnt work in the format | |
}else{ | |
cout<<"\n----------------------------------------------------------------------------------------------------------------------------------------------------------\n"; | |
i = i + 1; | |
//goto label2; | |
} | |
} | |
} | |
} | |
else | |
{ | |
cout<<"that is not a valid response please try again or would you like to add some more information points\nplease type yes to add a new point"<<endl; | |
string response_4; | |
cin>>response_4; | |
if(response_4 == "yes") | |
{ | |
cout<<"what category would you like to change\nmodule\nclasses\nlecturer\nrooms\nstudent"<<endl; | |
string response_5; | |
cin>>response_5; | |
if(response_5 == "module") | |
{ | |
cout<<"give a new module name"<<endl; | |
string response_6; | |
cin>>response_6; | |
module_names[5]= response_6; | |
cout<<"your new module has been added"<<endl; | |
} | |
if(response_5 == "classes") | |
{ | |
cout<<"give a new class name"<<endl; | |
string response_6; | |
cin>>response_6; | |
classes_names[10]= response_6; | |
cout<<"your new class has been added"<<endl; | |
} | |
if(response_5 == "lecturer") | |
{ | |
cout<<"give a new lecturer name"<<endl; | |
string response_6; | |
cin>>response_6; | |
lecturer_names[5]= response_6; | |
cout<<"your new lecturer has been added"<<endl; | |
} | |
if(response_5 == "rooms") | |
{ | |
cout<<"give a new room name"<<endl; | |
string response_6; | |
cin>>response_6; | |
room_names[5]= response_6; | |
cout<<"your new room has been added"<<endl; | |
} | |
if(response_5 == "student") | |
{ | |
cout<<"give a new student name"<<endl; | |
string response_6; | |
cin>>response_6; | |
student_names[10]= response_6; | |
cout<<"your new student has been added"<<endl; | |
} | |
} | |
cout<<"type yes to continue"<<endl; | |
string response_7; | |
cin>>response_7; | |
if(response_7 == "yes") | |
{ | |
goto label1; | |
} | |
else | |
return 0; | |
return 0; | |
} | |
} |