G2A Many GEOs
SHARE
TWEET

score from chars in string

JOHNYTHEWINNER Feb 1st, 2020 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # include <iostream>
  2. using namespace std;
  3. #include <iomanip>
  4. #include <math.h>
  5. #include <cmath>
  6. #include <string>
  7. int main()
  8. {
  9.     string str;
  10.     getline(cin, str);
  11.     int b = str.length();
  12.     int score=0;
  13.     for (int i = 0; i < b; i++)
  14.     {
  15.         if (str[i] == 'a')
  16.         {
  17.             score = score + 1;
  18.         }
  19.         else if (str[i] == 'e')
  20.         {
  21.             score = score + 2;
  22.         }
  23.         else if (str[i] == 'i')
  24.         {
  25.             score = score + 3;
  26.         }
  27.         else if (str[i] == 'o')
  28.         {
  29.             score = score + 4;
  30.         }
  31.         else if (str[i] == 'u')
  32.         {
  33.             score = score + 5;
  34.         }
  35.     }
  36.     cout << score << endl;
  37. }
RAW Paste Data
Ledger Nano X - The secure hardware wallet
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