artemgf

Первый раз в первый класс

Oct 29th, 2017
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.94 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #define _USE_MATH_DEFINES
  3. #include <iostream>
  4. #include <string>
  5. #include <map>
  6. #include <set>
  7. #include <algorithm>
  8. #include <vector>
  9. #include <stdio.h>
  10. #include <cmath>
  11. #include <math.h>
  12. #include <queue>
  13.  
  14. using namespace std;
  15.  
  16. void add(string name)
  17. {
  18.     for (int i = 1; i <= 10 - name.size(); i++)
  19.         cout << " ";
  20. }
  21.  
  22. int main()
  23. {
  24.     map<string, map<int, vector<string>>>raspes;
  25.     int n;
  26.     cin >> n;
  27.     string day, name;
  28.     int par;
  29.     vector <string> prom;
  30.     prom.push_back("");
  31.     for (int i = 1; i <= 4; i++)
  32.     {
  33.         raspes["Thursday"][i] = prom;
  34.         raspes["Tuesday"][i] = prom;
  35.         raspes["Saturday"][i] = prom;
  36.     }
  37.     for (int i = 1; i <= n; i++)
  38.     {
  39.         cin >> name;
  40.         vector <string> k;
  41.         string N;
  42.         N = name;
  43.         cin >> name;
  44.         while (name != "Thursday"&&name != "Tuesday"&&name != "Saturday")
  45.         {
  46.             if (N.size() + name.size()+1 <= 10)
  47.                 N += " " + name;
  48.             else
  49.             {
  50.                 k.push_back(N);
  51.                 N = name;
  52.             }
  53.             cin >> name;
  54.         }
  55.         k.push_back(N);
  56.         if (k.size() == 0)
  57.             k.push_back("");
  58.         day = name;
  59.         cin >> par;
  60.         raspes[day][par] = k;
  61.     }
  62.  
  63.     for (int i = 1; i <= 4; i++)
  64.     {
  65.         cout << "+----------+----------+----------+" << endl;
  66.         int Th = raspes["Thursday"][i].size() - 1, T = raspes["Tuesday"][i].size() - 1, S = raspes["Saturday"][i].size() - 1;
  67.         int j = 0;
  68.         while (j <= Th || j <= T || j <= S)
  69.         {
  70.             cout << "|";
  71.             if (j <= T)
  72.             {
  73.                 cout << raspes["Tuesday"][i][j];
  74.                 add(raspes["Tuesday"][i][j]);
  75.             }
  76.             else
  77.                 cout << "          ";
  78.             cout << "|";
  79.             if (j <= Th)
  80.             {
  81.                 cout << raspes["Thursday"][i][j];
  82.                 add(raspes["Thursday"][i][j]);
  83.             }
  84.             else
  85.                 cout << "          ";
  86.             cout << "|";
  87.             if (j <= S)
  88.             {
  89.                 cout << raspes["Saturday"][i][j];
  90.                 add(raspes["Saturday"][i][j]);
  91.             }
  92.             else
  93.                 cout << "          ";
  94.             cout << "|";
  95.             cout << endl;
  96.             j++;
  97.         }
  98.     }
  99.     cout << "+----------+----------+----------+";
  100.  
  101.     system("pause");
  102.     return 0;
  103. }
Advertisement
Add Comment
Please, Sign In to add comment