Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- cout<<"Enter How many students in the class :"<<endl;
- int n;
- cin>>n;
- string s[n];
- vector<pair<string,string>>v[100];
- vector<string>V;
- for(int i=0; i<n; i++)
- {
- cout<<"Enter students name :"<<endl;
- cin>>s[i]; ///Example : sagar
- cout<<"Enter how many course "<<i+1<<" student want to take "<<endl;
- int x;
- cin>>x;
- int count=0;
- dd:
- while(count<x)
- {
- string time,date,name;
- cout<<"Enter course name, date and time"<<endl;///Example datacom 5/7/20 5:00PM
- cin>>name>>date>>time;
- for(int j=0; j<v[i].size(); j++)
- {
- if(v[i][j].first==date and v[i][j].second==time)
- {
- cout<<"Conflict with time and date .Please enter again"<<endl;
- goto dd;
- }
- }
- v[i].push_back(make_pair(date,time));
- V.push_back(name);
- count++;
- }
- }
- cout<<endl<<endl<<"Enter How many Teacher in the University :"<<endl;
- int n1;
- cin>>n1;
- string s1[n1];
- vector<pair<string,string>>v1[100];
- vector<string> V1;
- for(int i=0; i<n1; i++)
- {
- cout<<"Enter Teacher name :"<<endl;
- cin>>s1[i];
- cout<<"Enter how many course "<<i+1<<" Teacher want to take "<<endl;
- int x;
- cin>>x;
- int count=0;
- dd1:
- while(count<x)
- {
- string name;
- string time,date;
- cout<<"Enter course name ,date and time"<<endl;///Example datacom 5/7/20 5:00PM
- cin>>name>>date>>time;
- for(int j=0; j<v1[i].size(); j++)
- {
- if(v1[i][j].first==date and v1[i][j].second==time)
- {
- cout<<"Conflict with time and date .Please enter again"<<endl;
- goto dd1;
- }
- }
- v1[i].push_back(make_pair(date,time));
- V1.push_back(name);
- count++;
- }
- }
- cout<<"Here are the details of student and course take bye them "<<endl<<endl<<endl;;
- for(int i=0; i<n; i++)
- {
- cout<<endl<<"Name of student is "<<s[i]<<endl<<endl;;
- cout<<"Course taken by him is "<<endl;
- for(int j=0; j<v[i].size(); j++)
- {
- cout<<"course name is "<<V[j]<<endl;
- cout<<"Course time and date are ";
- cout<<v[i][j].first<<" "<<v[i][j].second<<endl;
- }
- }
- cout<<endl<<endl<<"Here are the details of Teacher and course take bye them "<<endl<<endl<<endl;;
- for(int i=0; i<n1; i++)
- {
- cout<<endl<<"Name of Teacher is "<<s[i]<<endl<<endl;;
- cout<<"Course taken by him is "<<endl;
- for(int j=0; j<v1[i].size(); j++)
- {
- cout<<"course name is "<<V1[j]<<endl;
- cout<<"Course time and date are ";
- cout<<v1[i][j].first<<" "<<v1[i][j].second<<endl;
- }
- }
- }
Add Comment
Please, Sign In to add comment