Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2020
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.75 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <cmath>
  4. using namespace std;
  5.  
  6.  
  7. int main()
  8. {
  9.     int numGames,tochki, countV=0,countT=0,countB=0,counter = 0;
  10.     string name, nameGame;
  11.     double tV=0, tT=0, tB=0,totalT=0;
  12.     double srtV=0, srtT=0, srtB=0;
  13.     double sum_tV = 0, sum_tT = 0, sum_tB = 0;
  14.  
  15.     cin >> name;
  16.     cin >> numGames;
  17.  
  18.     for (int i=1; i <=numGames;i++)
  19.     {
  20.  
  21.         counter++;
  22.        
  23.         cin >> nameGame;
  24.         cin >> tochki;
  25.  
  26.         if (nameGame == "volleyball")
  27.         {
  28.             countV++;
  29.            
  30.             tV = (tochki * 1.07);
  31.             sum_tV = sum_tV + tV;
  32.           //  cout << countV<<"  "<<tV<<endl;
  33.            // srtV = floor(sum_tV / countV);
  34.            
  35.         }
  36.         else if (nameGame == "tennis")
  37.         {
  38.             countT++;
  39.             tT = (tochki * 1.05);
  40.             sum_tT = sum_tT + tT;
  41.           //  srtT = floor(sum_tT / countT);
  42.           //  cout << countT << "  " << tT << endl;
  43.         }
  44.         else if (nameGame == "badminton")
  45.         {
  46.             countB++;
  47.             tB = (tochki* 1.02);
  48.             sum_tB = sum_tB + tB;
  49.           //  srtB =floor(sum_tB / countB);
  50.             //cout << countB << "  " << tB << endl;
  51.         }
  52.        // totalT =floor(sum_tV + sum_tB + sum_tT);
  53.      
  54.     }
  55.     srtV = floor(sum_tV / countV);
  56.     srtT = floor(sum_tT / countT);
  57.     srtB = floor(sum_tB / countB);
  58.     totalT = floor(sum_tV + sum_tB + sum_tT);
  59.  
  60.     if ((srtV > 75) && (srtV > 75) && (srtV > 75))
  61.     {
  62.         cout << "Congratulations, " << name << "! You won the cruise games with " << totalT << " points.";
  63.     }
  64.     else
  65.     {
  66.         cout << "Sorry, " << name << ", you lost. Your points are only " << totalT << ".";
  67.     }
  68.  
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement