when I check my program, there is the "expected output, not a prompt for input" error for every input they are trying to check. however, when I am testing it, all inputs seem to be exactly the same as the output the check requires. Here is the code:
int main(int argc, string argv[])
{
if (argc!=2)
{
printf("Please, enter one keyword.\n");
return 1;
}
string Key = argv[1];
int KeyLen = strlen(Key);
for (int i=0; i<KeyLen;i++)
{
if (isalpha(Key[i]))
{
Key[i]=tolower(Key[i]);
}
else
{
printf("The key should not contain non-alphabetic characters.\n");
return 1;
}
}
string UserInput = GetString();
int InputLen= strlen(UserInput);
int KeyCount = 0;
int j;
for (j=0; j<InputLen; j++)
{
if (isalpha(UserInput[j]))
{
if(islower(UserInput[j]))
{
printf("%c", ((((UserInput[j]-97)+(Key[KeyCount]-97))%26)+97));
if(KeyCount<KeyLen-1)
{
if(KeyLen>1)
{
KeyCount++;
}
}
else
{
KeyCount=0;
}
}
if(isupper(UserInput[j]))
{
printf("%c", ((((UserInput[j]-65)+(Key[KeyCount]-97))%26)+65));
if(KeyCount<KeyLen-1)
{
if(KeyLen>1)
{
KeyCount++;
}
}
else
{
KeyCount=0;
}
}
}
else
{
printf("%c", (UserInput[j]));
}
}
printf("\n");
return 0;
}
What am I doing wrong? Thank you in advance!!!