How can i create a input that only allows the letters a b c d

The console will ask to please enter a letter. And they can only enter the letters a b c d.

And if they enter it, it says thank you for enter a, or b or c or d.

Recommended Answers

I'm sure I've seen someone else ask this question on here, I might be wrong! Please show that you have at least tried :P

Jump to Post

All 3 Replies

I'm sure I've seen someone else ask this question on here, I might be wrong! Please show that you have at least tried :P

I'll give you an idea:

initialise (char) c; 

do 
 -> input c 

 -> while (c IS NOT 'a', OR 'b', OR 'c')

 -> print "Yes I did it!!"

This next link may also give you some ideas for input in a loop ...

Note the steps.

6 Steps

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.