rafid_shad

University Management

May 8th, 2020 (edited)
1,424
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.10 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     cout<<"Enter How many students in the class :"<<endl;
  7.     int n;
  8.     cin>>n;
  9.  
  10.     string s[n];
  11.     vector<pair<string,string>>v[100];
  12.     vector<string>V;
  13.     for(int i=0; i<n; i++)
  14.     {
  15.         cout<<"Enter students name :"<<endl;
  16.         cin>>s[i];  ///Example : sagar
  17.         cout<<"Enter how many course "<<i+1<<" student want to take "<<endl;
  18.         int x;
  19.         cin>>x;
  20.         int count=0;
  21. dd:
  22.         while(count<x)
  23.         {
  24.             string time,date,name;
  25.             cout<<"Enter course name, date and time"<<endl;///Example datacom 5/7/20 5:00PM
  26.             cin>>name>>date>>time;
  27.  
  28.             for(int j=0; j<v[i].size(); j++)
  29.             {
  30.  
  31.                 if(v[i][j].first==date and v[i][j].second==time)
  32.                 {
  33.                     cout<<"Conflict with time and date .Please enter again"<<endl;
  34.                     goto dd;
  35.                 }
  36.             }
  37.             v[i].push_back(make_pair(date,time));
  38.             V.push_back(name);
  39.             count++;
  40.         }
  41.  
  42.     }
  43.     cout<<endl<<endl<<"Enter How many Teacher in the University :"<<endl;
  44.     int n1;
  45.     cin>>n1;
  46.     string s1[n1];
  47.     vector<pair<string,string>>v1[100];
  48.     vector<string> V1;
  49.     for(int i=0; i<n1; i++)
  50.     {
  51.         cout<<"Enter Teacher name :"<<endl;
  52.         cin>>s1[i];
  53.         cout<<"Enter how many course "<<i+1<<" Teacher want to take "<<endl;
  54.         int x;
  55.         cin>>x;
  56.         int count=0;
  57. dd1:
  58.         while(count<x)
  59.         {
  60.             string name;
  61.             string time,date;
  62.             cout<<"Enter course name ,date and time"<<endl;///Example datacom 5/7/20 5:00PM
  63.             cin>>name>>date>>time;
  64.  
  65.             for(int j=0; j<v1[i].size(); j++)
  66.             {
  67.  
  68.                 if(v1[i][j].first==date and v1[i][j].second==time)
  69.                 {
  70.                     cout<<"Conflict with time and date .Please enter again"<<endl;
  71.                     goto dd1;
  72.                 }
  73.             }
  74.             v1[i].push_back(make_pair(date,time));
  75.             V1.push_back(name);
  76.             count++;
  77.         }
  78.  
  79.     }
  80.  
  81.     cout<<"Here are the details of student and course take bye them "<<endl<<endl<<endl;;
  82.  
  83.  
  84.  
  85.     for(int i=0; i<n; i++)
  86.     {
  87.         cout<<endl<<"Name of student is "<<s[i]<<endl<<endl;;
  88.  
  89.         cout<<"Course taken by him is "<<endl;
  90.  
  91.         for(int j=0; j<v[i].size(); j++)
  92.         {
  93.             cout<<"course name is "<<V[j]<<endl;
  94.             cout<<"Course time and date are ";
  95.             cout<<v[i][j].first<<" "<<v[i][j].second<<endl;
  96.         }
  97.     }
  98.  
  99.     cout<<endl<<endl<<"Here are the details of Teacher and course take bye them "<<endl<<endl<<endl;;
  100.  
  101.  
  102.  
  103.     for(int i=0; i<n1; i++)
  104.     {
  105.         cout<<endl<<"Name of Teacher is "<<s[i]<<endl<<endl;;
  106.  
  107.         cout<<"Course taken by him is "<<endl;
  108.  
  109.         for(int j=0; j<v1[i].size(); j++)
  110.         {
  111.             cout<<"course name is "<<V1[j]<<endl;
  112.             cout<<"Course time and date are ";
  113.             cout<<v1[i][j].first<<" "<<v1[i][j].second<<endl;
  114.         }
  115.     }
  116.  
  117.  
  118.  
  119. }
Add Comment
Please, Sign In to add comment