First of all, there are some braces missing in the if
blocks. They look like this
if (encrypt <= 'A' && encrypt >= 'Z')
{
encrypt = encrypt + shift;
But there should be a }
after that. Also, you have conditions like those:
(encrypt <= 'a' && >= 'z')
I think you meant (encrypt <= 'a' && encrypt >= 'z')
instead. Likewise for the encrypt
part. All in all the code fragment should probably look like this:
if (encrypt <= 'A' && encrypt >= 'Z')
{
encrypt = encrypt + shift;
}
else if (encrypt <= 'a' &&encrypt >= 'z')
{
encrypt = encrypt + shift;
}
if (decrypt <= 'A' && decrypt >= 'Z')
{
decrypt = decrypt - shift;
}
else if (decrypt <= 'a' && decrypt >= 'z')
{...}
A tip for future questions: your snippet was sufficient for demonstrating the issue, but it took some effort to get it to work. It is generally appreciated when there’s a Minimal, Complete, and Verifiable example that people can just plop into their IDE and run.