How to make the program check if the input is an English word and if it contains certain letters? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

How to make the program check if the input is an English word and if it contains certain letters?

I am going to make a word game with C++ and it should contain the following things: 1.Requiring users to input a word. 2.Checking if the input is an English word and if it contains certain letter. 3.If so, printing a word different from the previous words, containing certain letter. 4.Requiring users to input a word again, different from the previous words, containing certain letters. 5.Checking if the input is the same as any words before. 6.It’s better allowing players to compete with each other. e.g. Given letters:[ce] Player: cell — Program: concert — Player: contest — Program: Game over. Player 1: process — Player 2: succeed — Program: certainly — Player 1: succeed — Program: Game over. How can I make that game? Can it be made with HTML or other language?

2nd Jun 2018, 10:23 AM
Alice
Alice - avatar
3 Answers
2nd Jun 2018, 10:27 AM
Calviղ
Calviղ - avatar
+ 1
Alice I believe what you are trying to achieve here is similar to an english spell checker app with a dictionary for your game. This definitely need some help from external libraries or API. To give a head start, you could refer the below link: https://stackoverflow.com/questions/4521456/c-check-whether-a-word-is-spelled-correctly hope this could help.
2nd Jun 2018, 10:47 AM
Learner1790
0
Don't know about the english, but if you use count (in Python) like this: if word.count("a") == 0: print("The letter a is inside the word!")
2nd Jun 2018, 10:47 AM
Paul Grasser
Paul Grasser - avatar