i want to trap the letter
example:
when i enter a leter it must be invalid input
input
Enter your choice:qweqwe
output
Invalid input
that is the problem
switch(product) {
case 1://...
//...
default://Wrong input
}
Well scanf() is VERY sensitive to wrong inputs. Usually if you want to catch errors you should just read whole string and then manually parse it. If you want safe input operations - use c++ streams.
the How many items do you want to avail,Cash,Change. how to trap the letter
well I did that with the code:
if (isdigit(ch[0]))
If you want to do it for the other input, you can see how to do it. A seperate function to acheive that might be advisable if you are repeatedly using it.