Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int booled_string (string word)
- // edited the hash code by http://stackoverflow.com/users/779920/nick
- { int sum = 0;
- for (int k = 0; k < word.length(); k++)
- sum = sum + int(word[k]);
- return sum % 2;
- }
- int main()
- {
- string seed;
- int answer;
- while (seed != "stop")
- {
- getline(cin, seed);
- answer = booled_string(seed);
- if (answer)
- {
- cout << "yes" << endl;
- }
- else
- {
- // if you type "stop" it lets out a creepy "no" b4 it closes i love it
- cout << "no" << endl;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement