#include <stdio.h>
#include <string.h>
#include <cs50.h>
#include <ctype.h>
bool check_alpha(string k);
// this code is to check if the function for checking if it's an alphabetical key string works or not
int main(int argc, string argv[])
{
if (argc != 1)
{
// get key from command line argument
string key = argv[(argc - 1)];
// check if the key string is alphabetical
bool y = check_alpha(key);
if ( y )
{
printf("The key string is alphabetical.\n");
}
else
{
printf("The key string is not alphabetical.\n");
}
}
}
bool check_alpha(string k)
{
int l=strlen(k);
int i=0;
while ( (k[i] != '\0') && (isalpha(k[i])) )
{
i++;
}
if ( i == l )
{
return true;
}
else
{
return false;
}
}