samedi 24 octobre 2020

C++ How can I make a function that determines if all the letters in a word contain ONLY letters in a list of acceptable letters (both user provided)

I am so confused only what to do. The if statement is intentionally blank in my Tester function because that is what I am confused on. Ex: LIST OF GOOD LETTERS: CODING Acceptable word: COIN Unacceptable word: COP

Here is what I have thus far:

#include <iostream>
#include <string>
using namespace std;

bool Tester(string inputtedWord, string acceptableLetters){
     if(){
           cout << "Good!" << endl;
           return true;
         }
     else
{
    cout << "No good!" << endl;
    return false;
}
}

int main() {
string acceptableLetters;
string inputtedWord;

cout << "Please input the acceptable letters in your words: " << endl;
cin >> acceptableLetters;

while(inputtedWord != "STOP"){
    cout << "Please input the word you would like to test: (type STOP to end testing)" << endl;
    cin >> inputtedWord;
    Tester(inputtedWord, acceptableLetters);
}
return 0;
}

Aucun commentaire:

Enregistrer un commentaire