i have this to check for numeric inputs, which returns then menu if a number is entered less or grater than 5 but how would you do this with alphabets ? for any alphabet or any other charterer apart from numbers should return the menu

while (select < 1 || select > 5) ;
	        return select;

Recommended Answers

All 9 Replies

while (select < 'A' || select > 'E')

Single quotes denote the character

i dont want the program to accept alphabets only numbers

If you're using an Edit control on a Dialog, just set the properties to numeric. If not, in ctype.h there is the function isdigit.

while (select < 'A' || select > 'E')

Single quotes denote the character

i dont want the program to accept alphabets only numbers

You could look at my suggestion and maybe convert it into something you can use.

That's the idea behind programming. Take something similar and make it fit your situation.

Alphabet input can be checked by conforming that whether the input given is a character or not by comparing the input with the ASCII Codes of the alphabets if the inputs's ACSII code is in between the Charter's ASCII CODES series then the input provided is the character

Alphabet input can be checked by conforming that whether the input given is a character or not by comparing the input with the ASCII Codes of the alphabets if the inputs's ACSII code is in between the Charter's ASCII CODES series then the input provided is the character

Man, those translation sites really do a great job, don't they?

Yes, Walt it fully works

i dont want the program to accept alphabets only numbers

isdigit()

Be a part of the DaniWeb community

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