Advertisement
PikingFish

PE. Diary

Sep 22nd, 2020 (edited)
73
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. #include <algorithm>    // random_shuffle
  4. #include <vector>      
  5. #include <ctime>        
  6. #include <cstdlib>      // rand, srand
  7. #include <fstream>
  8.  
  9. using namespace std;
  10.  
  11. //minNumberOfTraining + rand() % maxNumberOfTraining
  12.  
  13. int main()
  14. {
  15.     string answer;
  16.    
  17.     int numberOfStudents = 20;
  18.     int exercise_number = 32;
  19.    
  20.     ofstream out;
  21.     out.open("output.txt");
  22.      
  23.     string exercises[exercise_number] = {
  24.     "Ïîäòÿãèâàíèÿ 3 ïîäõîäà. 6 ïîâòîðåíèé",
  25.     "Øèðîêèå îòæèìàíèÿ. 3 ïîäõîäà. 15 ïîâòîðåíèé",
  26.     "Óçêèå îòæèìàíèÿ. 3 ïîäõîäà. 15 ïîâòîðåíèé",
  27.     "Æèì ë¸æà. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  28.     "Á¸ðïè. 3 ïîäõîäà. 20 ïîâòîðåíèé",
  29.     "Ïëàâàíèå: êðîëü. 40 áàññåéíîâ. 25 ìåòðîâ",
  30.     "Ïëàâàíèå: áðàñ. 40 áàññåéíîâ. 25 ìåòðîâ",
  31.     "Ïëàâàíèå: áàòòåðôëÿé. 20 áàññåéíîâ. 25 ìåòðîâ",
  32.     "Ïëàâàíèå: íà ñïèíå. 20 áàññåéíîâ. 25 ìåòðîâ",
  33.     "Âåðòèêàëüíàÿ òÿãà â íàêëîíå. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  34.     "Ðàçâåäåíèå ãàíòåëåé ë¸æà íà íàêëîííîé ñêàìüå. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  35.     "Òÿãà âåðõíåãî áëîêà ê ãðóäè øèðîêèì õâàòîì. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  36.     "Æèì îäíîé ðóêîé â êðîññîâåðå. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  37.     "Ïóëîâåð ñ ãàíòåëüþ. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  38.     "Ïðèñåä ñî øòàíãîé íà ñïèíå. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  39.     "Ðóìûíñêàÿ òÿãà. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  40.     "Ðàçãèáàíèå íîã â òðåíàæ¸ðå. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  41.     "Ñãèáàíèå íîã â òðåíàæ¸ðå. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  42.     "Ñêðó÷èâàíèÿ. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  43.     "Ïëàíêà. 3 ïîäõîäà. 30 ñåêóíä",
  44.     "Òÿãà âåðõíåãî áëîêà íà øèðî÷àéøèå îáðàòíûì õâàòîì. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  45.     "Îòæèìàíèÿ íà áðóñüÿõ. 3 ïîäõîäà. 7 ïîâòîðåíèé",
  46.     "Ïîäú¸ì ãàíòåëåé íà áèöåïñ. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  47.     "Ðàçãèáàíèå ðóê ñ ãàíòåëüþ íà òðèöåïñ. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  48.     "Ñãèáàíèå ðóê íà áèöåïñ â êðîññîâåðå. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  49.     "Ðàçãèáàíèå ðóê íà òðèöåïñ â êðîññîâåðå. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  50.     "Æèì ãàíòåëåé ââåðõ ñèäÿ. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  51.     "Ìàõè ãàíòåëÿìè ÷åðåç ñòîðîíû ñèäÿ. 3 ïîäõîäà 10 ïîâòîðåíèé",
  52.     "Âåðòèêàëüíàÿ òÿãà EZ-øòàíãè ê ïîäáîðîäêó. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  53.     "Ïîäú¸ì êîëåíåé â âèñå. 3 ïîäõîäà 10 ïîâòîðåíèé",
  54.     "Ñêðó÷èâàíèÿ ñ îòÿãîùåíèåì. 3 ïîäõîäà. 10 ïîâòîðåíèé",
  55.     "Îáðàòíûå ñêðó÷èâàíèÿ. 3 ïîäõîäà. 10 ïîâòîðåíèé"
  56.     };
  57.    
  58.     srand ( unsigned ( time(0) ) );
  59.     vector <int> randomIndex;
  60.    
  61.     for (int i = 0; i < exercise_number; i++) //set values
  62.         randomIndex.push_back(i);
  63.        
  64.     int maxNumberOfTraining = 10;
  65.     int minNumberOfTraining = 5;
  66.     int numberOfTraining;
  67.    
  68.     for(int k = 1; k < numberOfStudents + 1; k++)
  69.     {
  70.         out << "Student #" << k;
  71.         numberOfTraining = rand() % (maxNumberOfTraining - minNumberOfTraining + 1) + minNumberOfTraining;
  72.         cout << numberOfTraining;
  73.        
  74.         // random index generator:
  75.         random_shuffle ( randomIndex.begin(), randomIndex.end() );
  76.    
  77.         /*// print out randomIndex vector:
  78.         cout << "randomIndex contains:";
  79.         for (vector<int>::iterator it = randomIndex.begin(); it != randomIndex.end(); it++)
  80.                 cout << ' ' << *it;*/
  81.    
  82.         //print out random training list into output
  83.         for(int j = 0; j < numberOfTraining; j++)
  84.         {
  85.             if (j == 0)
  86.                 out << endl << j + 1 << ". " << exercises[randomIndex.at(j)];
  87.             else
  88.                 out << endl << j + 1 << ". " << exercises[randomIndex.at(j)];  
  89.         }
  90.         out << endl;
  91.     }
  92.     return 0;
  93. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement