Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #include <vector>
- using namespace std;
- int main()
- {
- int day = 0;
- int month = 0;
- int q = 0;
- int i = 0;
- int NextMonth = 0;
- string command;
- string s;
- vector<int> days = { 31,28,31,30,31,30,31,31,30,31,30,31 };
- vector<vector<string>> alpha(days[month]);
- cin >> q;
- for (auto iteration = 0; iteration <= q; iteration++) {
- cin >> command;
- if (command == "ADD") {
- cin >> i >> s;
- alpha[i-1].push_back(s);
- }
- else if (command == "NEXT") {
- NextMonth = month + 1;
- if (NextMonth > 11)
- NextMonth = 0;
- if (days[NextMonth] > days[month])
- alpha.resize(days[NextMonth]);
- else {
- int counter = 0;
- for (counter = days[month] - 1; counter >= (days[NextMonth] - 1); counter--) {
- alpha[days[NextMonth] - 1].insert(end(alpha[days[NextMonth] - 1]), begin(alpha[counter]), end(alpha[counter]));
- }
- alpha.resize(days[NextMonth]);
- }
- month += 1;
- }
- else if (command == "DUMP") {
- cin >> i;
- for (auto x : alpha[i-1]) {
- cout << x << endl;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement