This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool Hangman::isAlpha(const QString& key) | |
| { | |
| if (alphabet.size() > 0) | |
| { | |
| return alphabet.contains(key.toUpper()); | |
| } | |
| return false; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Add letters to our vector using ASCII conversion (saves typing =p) | |
| for (int i = 65; i < 91; i++) | |
| { | |
| char letter = static_cast<char> (i); | |
| alphabet.push_back(QString(letter)); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| QList<int> Hangman::findAllOccurrences(const QChar& theChar, const QString& theStr) | |
| { | |
| QList<int> occurrences; | |
| for (int i = 0; i < theStr.size(); i++) | |
| { | |
| if (theStr.at(i).toUpper() == theChar.toUpper()) | |
| { | |
| occurrences.push_back(i); | |
| } | |
| } |
NewerOlder