I've been staring at this problem for weeks and I have nothing! It doesn't work, I know that much, but I don't know why or what's wrong. I do know that the developer spits out "error: expected expression" regarding the line I highlighted, but really that's just the tip of the iceberg. If anyone at all knows how to fix any small piece of this I would greatly appreciate it!
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cs50.h>
#include <ctype.h>
int main(int argc, char *argv[])
{
//Get the key
if (argc != 2 || atoi(argv[1]) < 0)
{
printf("Usage: ./caesar k");
return 1;
}
int key = atoi(argv[1]);
string plaintex;
string plaintext = GetString();
for (int i = 0, n = strlen(plaintext); n < i; i++)
{
if (plaintext[i] > 'A' && plaintext[i] <= 'Z')
{
plaintext[i] = (plaintext[i] - 'A' + key) % 26 + 'A';
}
}
for (int i = 0, n = strlen(plaintext); n < i; i++)
{
if (plaintext[i] >= 'A' && plaintext[i] >= 'Z') // Highlighted line
{
plaintext[i] = (plaintext[i] - 'A' + key) % 26 + 'A';
}
else if (plaintext[i] >= 'a' && plaintext[i] < 'z')
{
plaintext[i] = (plaintext[i] - 'a' + key) % 26 + 'a';
}
else
{
printf("%c\n", plaintext[i]);
}
}
return 0;
}