0

I am having some issues with my code, clang continues to say use of a undeclared identifier when I have identified the variable that I would like to use. Can some one help me with this issue. My code is pasted below.

include

include

include

include

include

include

int main(int argc, string argv[])

{

const int Key = atoi(argv[1]);
bool isKeyValid = true;
int rod = strlen(argv[1]);
int i = rod;

if(argc != 2)
{
    do
    {
    printf("Usage: ./caesar key ");

    }while(Key < 0);
    return 1;
}


if(isdigit(argv[1][i]) == false)
{

    isKeyValid = false;

}
if(isKeyValid == true)

{

    string plain = get_string("Plaintext: ");
    int plainLength = strlen(plain);
}
for(int j = 0; (rod == strlen(plain[i])); j < rod; j++)
{
    if (islower(plain[i]))
    {
        printf("%c\n", plain[i] -'a' + k % 26 + 'a');
    }
    else if(isupper(plain[i]))
    {
        printf("%c\n", plain[i] -'A' + k % 26 + 'A');
    }
    else
    {
        printf("%c\n", plain[i]);
    }

}
printf("\n");

}

2
  • 1
    Please edit the question and add the error message you are receiving. You should also fix the code formating, when you are editing the question, select the code and format with the {} button in the format bar. Commented Apr 22, 2020 at 10:35
  • isdigit only returns as a zero or nonzero value as well. Commented Jun 14, 2020 at 18:14

0

You must log in to answer this question.

Browse other questions tagged .