Advertisement
Filkolev

Joro The Football Player - C++

Oct 13th, 2014
334
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.64 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. #include <sstream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string typeOfYear;
  9.     int holidays, hometownWeekends;
  10.     double totalPlays;
  11.     string mystr;
  12.  
  13.     getline(cin, mystr);
  14.     stringstream(mystr) >> typeOfYear;
  15.     getline(cin, mystr);
  16.     stringstream(mystr) >> holidays;
  17.     getline(cin, mystr);
  18.     stringstream(mystr) >> hometownWeekends;
  19.  
  20.     double normalPlays = (52 - hometownWeekends) * 2.0 / 3;
  21.  
  22.     totalPlays = hometownWeekends;
  23.     totalPlays += normalPlays;
  24.     totalPlays += holidays / 2.0;
  25.  
  26.     if (typeOfYear == "t")
  27.     {
  28.         totalPlays += 3;
  29.     }
  30.  
  31.     int result = (int)totalPlays;
  32.  
  33.     cout << result;
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement