Vla_DOS

Untitled

Jan 23rd, 2022
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.28 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <string.h>
  4. #include<sstream>
  5. #include <ctype.h>
  6. #include<cctype>
  7. #include<list>
  8. #include <vector>
  9. using namespace std;
  10.  
  11. struct Mystruct
  12. {
  13.     string city;
  14.     string institute;
  15.     string faculty;
  16.  
  17.     vector<string> tm;
  18.     vector<vector<string>> listOfSpecialties;
  19.  
  20.    
  21.     string planOfAdmissionToTheFirstYear;
  22.     int passingScore;
  23.  
  24. } MystructArr[2];
  25.  
  26. using namespace std;
  27.  
  28. int main()
  29. {
  30.     setlocale(0, "");
  31.     int i;
  32.  
  33.     for (i = 0; i < 2; i++)
  34.     {
  35.         MystructArr[0].city = "Київ";
  36.         MystructArr[1].city = "Вінниця";
  37.         MystructArr[i].faculty = "Право";
  38.         MystructArr[0].institute = "Політехнічний";
  39.         MystructArr[1].institute = "НУБіП";
  40.         for (int f = 0; f < 2; f++) {
  41.             MystructArr[0].tm.push_back("Програмування");
  42.             MystructArr[0].listOfSpecialties.push_back(MystructArr[0].tm);
  43.  
  44.         }
  45.         MystructArr[i].planOfAdmissionToTheFirstYear = "____";
  46.         MystructArr[i].passingScore = 10 + (i + 1);
  47.  
  48.     }
  49.  
  50.  
  51.     for (i = 0; i < 2; i++)
  52.     {
  53.         cout << MystructArr[i].city << endl;
  54.         cout << MystructArr[i].faculty << endl;
  55.         cout << MystructArr[i].institute << endl;
  56.         for (int f = 0; f < MystructArr[i].listOfSpecialties.size(); f++)
  57.         {
  58.             cout << MystructArr[i].listOfSpecialties[f] << endl;
  59.         }
  60.         cout << MystructArr[i].planOfAdmissionToTheFirstYear << endl;
  61.         cout << MystructArr[i].passingScore << endl;
  62.  
  63.     }
  64.  
  65.     for (i = 0; i < 2; i++)
  66.     {
  67.         if (MystructArr[i].institute == "Політехнічний")
  68.             cout << MystructArr[i].city << endl;
  69.     }
  70.  
  71.  
  72.     cout << "нститути і факультети, де приймають студентів на перший курс за заданою користувачем спеціальністю\n";
  73.     for (i = 0; i < 2; i++)
  74.     {
  75.         for (int f = 0; f < MystructArr[i].listOfSpecialties.size(); f++)
  76.         {
  77.             if (MystructArr[i].listOfSpecialties[f] == "Програмування")
  78.             {
  79.                 cout << MystructArr[i].faculty << endl;
  80.                 cout << MystructArr[i].institute << endl;
  81.                 cout << MystructArr[i].city << endl;
  82.             }
  83.         }
  84.     }
  85.  
  86.  
  87.     std::cout << "///\n";
  88.     int max = -1;
  89.     for (int i = 0; i < 2; i++)
  90.     {
  91.         for (int f = 0; f < MystructArr[i].listOfSpecialties.size(); f++)
  92.         {
  93.             if (MystructArr[i].listOfSpecialties[f] == "Програмування")
  94.             {
  95.                 if (max < MystructArr[i].passingScore)
  96.                     max = MystructArr[i].passingScore;
  97.             }
  98.         }
  99.     }
  100.  
  101.     cout << "\nфакультет, інститут і місто, де на вказану користувачем спеціальність існує найвищий прохідний бал" << endl;    
  102.    
  103.     for (int i = 0; i < 2; i++)
  104.     {
  105.         if (MystructArr[i].passingScore == max)
  106.         {
  107.             std::cout << MystructArr[i].faculty << "\n";
  108.             std::cout << MystructArr[i].institute << "\n";
  109.             std::cout << MystructArr[i].city << "\n";
  110.         }
  111.     }
  112.     return 0;
  113. }
Advertisement
Add Comment
Please, Sign In to add comment