Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <iostream>
- #include <string>
- #include <vector>
- #include <ctime>
- int pref_months[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; // Days in month
- std::vector<std::string> list ={
- "Anisevich Egor",
- "Ardytskaya Karina",
- "Basik Denis",
- "Bychkovski Roman",
- "Evtikhov Artyom",
- "Karpuk Maksim",
- "Koliada Ilya",
- "Kuchinski Ilya",
- "Luksha Maria",
- "Parkhomenko Sasha",
- "Petlyova Sasha",
- "Polyakov Roman",
- "Prokopenia Karina",
- "Saevets Sofia",
- "Savcuk Emma",
- "Shepel Katia",
- "Shimanskaya Efrosinia",
- "Silenkova Dasha",
- "Stepanuk Kirill",
- "Zhuk Ksenia"
- }; // Main list of the klass
- int32_t main() {
- /*std::ifstream fin("klass.txt");
- std::string now;
- while(std::getline(fin, now))
- list.push_back(now);*/ //Add some people
- std::sort(list.begin(), list.end()); //Sort of the list
- for(int month = 1; month <= 12; month++)
- pref_months[month] += pref_months[month - 1]; //Count prefix sums for 1..12
- time_t t;
- struct tm *tm;
- int day, month;
- t = time(nullptr); //
- tm = localtime(&t); //Get localtime
- day = tm->tm_mday; //Get day
- month = tm->tm_mon; // Get month
- int today_duty = (pref_months[month - 1] + day) % list.size(); //Who is on duty
- std::cout << list[today_duty]; //Print, who is on duty
- }
Advertisement
Add Comment
Please, Sign In to add comment