How do you check for an integer in Caesar? The only problem I have is that I am unable to handle a non-numeric key. I understand fully what is meant by non-numeric, however, I am having an extremely difficult time with finding a way to implement it in my code.

1 Answer 1


All parameters given when a program starts are strings. So, you have to treat them as strings to start. To do this, you need to check each character in the parameter string to make sure that it is a digit or it isn't. Once you've checked them all and found that they are all digits, you can then use atoi().

Hints: Use a for loop. isdigit and isalpha can be your friends. So can the not operator, !.

You must log in to answer this question.