I am kind of stuck with my Vigenere Code so far... and i really feel like don´t know how to work it out from here! Any kind of advice is much appreciated, or i might be stuck here forever :(
#include <stdio.h>
#include <cs50.h>
#include <string.h>
#include <ctype.h>
int main(int argc, string argv[])
{
if (argc != 2)
{
printf("Please enter a key for the vigenere Cipher as commandline
argument!\n");
return 1;
}
int plainLen;
int keyValue;
string key = argv[1];
string plain;
for (int i = 0, n = strlen(key); i < n; i++)
{
if (isalpha(key[i]))
{
if (islower(key[i]))
{
toupper(key[i]);
keyValue = key[i] - 65;
}
else
{
keyValue = key[i] - 65;
}
}
}
printf("plaintext: ");
plain = GetString();
plainLen = strlen(plain);
printf("ciphertext: ");
for (int i = 0; i < plainLen; i++)
{
if (isupper(plain[i]))
{
printf("%c", (((plain[i] - 65) + key[i]) % 26) + 65);
}
else
{
printf("%c", (((plain[i] - 97) + key[i]) % 26) + 97);
}
}
printf("\n");
}