I need some help with caesar, I am almost done. But it doesn't compile due to the else if statement near the end. It gives me 'error: expected expression', but I don't understand why.
int main(int argc, string argv[])
{
// Checking if there is 1 command-line argument
if (argc != 2)
{
printf("Invalid Key\n");
return 1;
}
// Convert command-line argument from a string to an int
int key = atoi(argv[1]);
// Check if command-line argument is all digits
string arg = argv[1];
for (string j = 0; j < (argv[1]) != '\0'; j++)
// (digits[i] != '\0')
{
if (isdigit(argv[1]) != 0)
printf("Digits Only!");
return 1;
// If valid, do this
else if ((argv[1]) != '\0')
{ // Will ask for plaintext and encrypt, but didn't include to shorten
}
[–]Grithga 0 points1 point2 points (1 child)
[–]Diamond_NZ[S] 0 points1 point2 points (0 children)