Ledger Nano X - The secure hardware wallet
SHARE
TWEET

PC Game Shop - Dimitar Dimitrov

JOHNYTHEWINNER Feb 15th, 2020 112 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, countForHearthStone = 0, countForFornite = 0, countForOverWatch = 0, countForOthers = 0;
  8.     cin >> n;
  9.     double originaN = n;
  10.     cin.ignore();
  11.     while (n > 0) {
  12.         string input;
  13.         getline(cin, input);
  14.         if (input == "Hearthstone")
  15.         {
  16.             countForHearthStone++;
  17.         }
  18.         else if (input == "Fornite")
  19.         {
  20.             countForFornite++;
  21.         }
  22.         else if (input == "Overwatch")
  23.         {
  24.             countForOverWatch++;
  25.         }
  26.         else
  27.         {
  28.             countForOthers++;
  29.           }
  30.         n--;
  31.     }
  32.     cout.setf(ios::fixed);
  33.     cout.precision(2);
  34.     double result1 = (countForHearthStone * 100) / originaN*1.00;
  35.     double result2 = (countForFornite * 100) / originaN;
  36.     double result3 = (countForOverWatch * 100) / originaN;
  37.     double result4 = (countForOthers * 100) / originaN;
  38.     cout << "Hearthstone - " << result1 << "%" << endl;
  39.     cout << "Fornite - " << result2 << "%" << endl;
  40.     cout << "Overwatch - " << result3 << "%" << endl;
  41.     cout << "Others - " << result4 << "%" << endl;
  42.     return 0;
  43. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top