c++ - isalpha : If argv is not alphabets. How to conditionise? -
i have made program accepts 2 command line arguments in first argument file name itself, , second alphabetical keyword. if have reject numeric argument how conditionise, or write?
my pseudocode:
if argv[1] not alphabets reject it(return 1).
how do this? sorry i'm newbie computer programming , c in particular.
edit: second argument string. have check user enters string , no numberic value. if user inputs number, or string number( bacon11 ), program should reject , return 1; should do?
my code looks this:
// reject numeric value (int = 0, n = strlen(argv[1]); < n; i++) { if //todo: if letter not letter reject it. { return 1; } }
what should write in todo line? cant conditionise code!
you can use isalpha function.
edit: code seems in way. nevertheless, not work, can give clues!
- check this tutorials understand if statement (you check isalpha example).
- don't forget argv 2 dimensional character array. specific character of argument can do:
argv[i][j]
- check return value of isalpha function test character.
Comments
Post a Comment