Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int wordcompare(string InputWord, string AnswerWord) {
- // ? if : else
- int size = (InputWord.size() < AnswerWord.size()) ? InputWord.size() : AnswerWord.size();
- int DifferenceBetweenWords;
- for(int i= 0; i < size; i++){
- if(InputWord[i] == AnswerWord[i]){
- ++i;
- return DifferenceBetweenWords;
- }
- }
- }
- /*
- int main()
- {
- int DifferenceBetweenWords;
- string AnswerWord;
- cout << "please enter answer" << endl;
- cin << AnswerWord;
- if(DifferenceBetweenWords != AnswerWord.size() ){
- cout << "please enter first geuss" << endl;
- cin << InputWord;
- wordcmp(InputWord, AnswerWord)
- cout << DifferenceBetweenWords;
- }
- else{
- cout << "YOUW WON!!"}
- return 0;
- }
- */
- int main(){
- int WordSimilarityCount;
- string AnswerWord;
- string InputWord;
- cout << "Answer:" << endl;
- cin >> AnswerWord;
- do {
- cout << "Input next geuss (NOTE: Words cannot be longer then " << AnswerWord.size() << " )"<< endl;
- cin >> InputWord;
- cout << wordcompare(InputWord, AnswerWord) << endl;
- }while(AnswerWord.size() != wordcompare(AnswerWord, InputWord));
- cout << "You Won!" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement