So actually I wrote the code for vigenere mostly from caesar and changing it a bit where needed. I am actually not sure if the way i tried to change the argument vector i took into a string and finding its length is correct or not. And can you please see what else is wrong?
#include<stdio.h>
#include<ctype.h>
#include<cs50.h>
#include<string.h>
int main(int argc,char* argv[1])
{
char y;
if(argc==2)
{ string s=argv[1];
int a=strlen(s);
for(int c=0;c<a;c++)
{
if(isalpha(s[c])&&isupper(s[c])&&islower(s[c]))
{
printf("plaintext:");
string st=get_string();
int l=strlen(st);
printf("ciphertext: ");
for(int b=0;b<l;b++)
{
if(isalpha(st[b]))
{
if(isupper(st[b]))
{
for(int d=0;d<d%3;d++)
{
st[b]=((st[b]+(st[d]-65)))%26;
y =st[b]+65;
printf("%c",y);
}
}
else
{
for(int d=0;d<d%3;d++)
{
st[b]=((st[b]+(st[d]-97)))%26;
y=st[b]+97;
printf("%c",y);
}
}
}
else
{
printf("%c",st[b]);
}
}
printf("\n");
return 0;
}
}
}
else
{
printf("Enter the correct parameters\n");
return(1);
}
}
Thank you!! Hope the code is clear enough.