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?
university-timetable/main.cpp
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
144 lines (144 sloc)
3.03 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> | |
#include <vector> | |
#include <string> | |
using namespace std; | |
//inherting the parent class and the child class as student and timetable in a tabular column | |
class SearchClass : student,timetable | |
{ | |
String sname,stime,day; | |
public : | |
void search() | |
{ | |
int i,j,k=0,q=0; | |
cout << "Enter your name:"; | |
cin >> sname; | |
//using for loop condition to find the name as a search method | |
for(i=0;i<7;i++) | |
{ | |
if(name[i]==sname) | |
{ | |
k=1; | |
break; | |
} | |
} | |
if(k==1) | |
{ | |
cout << "Enter the day :"; | |
cin >> day; | |
if(day=="monday"||day=="Monday") | |
{ | |
cout << "Enter the time in this format <hour><AM or PM>:"; | |
cin >> stime; | |
for(j=0;j<7;j++) | |
{ | |
if(stime==time[j]) | |
{ | |
q=1; | |
break; | |
} | |
} | |
if(q==1) | |
{ | |
cout << "\n Subject | class | Room No. | time | faculty | Day "; | |
cout << "\n" << monday[class[i]][j] << "\t" << cl[class[i]] << "\t" << room_no[class[i]][j] << "\t" << time[j] << "\t" << faculty[class[i]][j] << "\t Monday"; | |
} | |
else | |
cout << "\nTime Not Found "; | |
} | |
else if(day=="tuesday||day=="Tuesday") | |
{ | |
cout << "Enter the time in this format <hour><AM or PM>:"; | |
cin >> stime; | |
for(j=0;j<7;j++) | |
{ | |
if(stime==time[j]) | |
{ | |
q=1; | |
break; | |
} | |
} | |
if(q==1) | |
{ | |
cout << "\n Subject | class | Room No. | time | faculty | Day "; | |
cout << "\n" << tuesday[class[i]][j] << "\t" << cl[class[i]] << "\t" << room_no[class[i]][j] << "\t" << time[j] << "\t" << faculty[class[i]][j] << "\t Tuesday"; | |
} | |
else | |
cout << "\nTime Not Found "; | |
} | |
else if(day=="wednesday||day=="Wednesday") | |
{ | |
cout << "Enter the time in this format <hour><AM or PM>:"; | |
cin >> stime; | |
for(j=0;j<7;j++) | |
{ | |
if(stime==time[j]) | |
{ | |
q=1; | |
break; | |
} | |
} | |
if(q==1) | |
{ | |
cout << "\n Subject | class | Room No. | time | faculty | Day "; | |
cout << "\n" << wednesday[class[i]][j] << "\t" << cl[class[i]] << "\t" << room_no[class[i]][j] << "\t" << time[j] << "\t" << faculty[class[i]][j] << "\t Wednesday"; | |
} | |
else | |
cout << "\nTime Not Found "; | |
} | |
else if(day=="thursday"||day=="Thursday") | |
{ | |
cout << "Enter the time in this format <hour><AM or PM>:"; | |
cin >> stime; | |
for(j=0;j<7;j++) | |
{ | |
if(stime==time[j]) | |
{ | |
q=1; | |
break; | |
} | |
} | |
if(q==1) | |
{ | |
cout << "\n Subject | class | Room No. | time | faculty | Day "; | |
cout << "\n" << thursday[class[i]][j] << "\t" << cl[class[i]] << "\t" << room_no[class[i]][j] << "\t" << time[j] << "\t" << faculty[class[i]][j] << "\t thursday"; | |
} | |
else | |
cout << "\nTime Not Found "; | |
} | |
else if(day=="friday"||day=="Friday") | |
{ | |
cout << "Enter the time in this format <hour><AM or PM>:"; | |
cin >> stime; | |
for(j=0;j<7;j++) | |
{ | |
if(stime==time[j]) | |
{ | |
q=1; | |
break; | |
} | |
} | |
if(q==1) | |
{ | |
cout << "\n Subject | class | Room No. | time | faculty | Day "; | |
cout << "\n" << friday[class[i]][j] << "\t" << cl[class[i]] << "\t" << room_no[class[i]][j] << "\t" << time[j] << "\t" << faculty[class[i]][j] << "\t Friday"; | |
} | |
else | |
cout << "\nTime Not Found "; | |
} | |
else | |
cout << "\nTime Not Found "; | |
} | |
else | |
cout << "\nDay Not Found"; | |
} | |
else | |
cout << "\nName Not Found"; | |
} | |
}; | |
//tabular datastructure to represent the class ,room no,faculty and the day | |
int main() | |
{ | |
SeaarchClass a; | |
a.search(); | |
return 0; | |
} |