0

I am using the following to indicate that if a number is used as the command line argument in vigenere to prompt the user for letters only but I can't wrap my mind around how this takes into account all numbers?

if(isalpha(argv[1][i]) == 0)

0

Presumably, you have that in a loop that is looping over the length of argv[1]. So if the user typed:

./vigenere abc123

argv[1] would equal "abc123" and your loop first time round would be checking

if (isalpha(argv[1][0]) == 0)

etc.

isalpha('a')  //true
isalpha('b')  //true
isalpha('c')  //true
isalpha('1')  //false so yell at user and return 1.

Is this what you meant?

| improve this answer | |
  • the same error occurred with me .but solved after your answer – user7074 May 13 '15 at 18:33
  • Oh that makes sense, thank you for the clarification. – HMiddleton May 14 '15 at 16:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .