Advertisement
Guest User

charlie charlie c++

a guest
May 27th, 2015
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstdlib>
  3.  
  4. using namespace std;
  5.  
  6. int booled_string (string word)
  7. // edited the hash code by http://stackoverflow.com/users/779920/nick
  8. {       int sum = 0;
  9.         for (int k = 0; k < word.length(); k++)
  10.             sum = sum + int(word[k]);
  11.         return  sum % 2;
  12. }
  13.  
  14. int main()
  15. {
  16.     string seed;
  17.     int answer;
  18.     while (seed != "stop")
  19.     {
  20.         getline(cin, seed);
  21.         answer = booled_string(seed);
  22.         if (answer)
  23.         {
  24.             cout << "yes" << endl;
  25.         }
  26.         else
  27.         {
  28.             // if you type "stop" it lets out a creepy "no" b4 it closes i love it
  29.             cout << "no" << endl;
  30.         }
  31.     }
  32.     return 0;
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement