For some reason my check50 is failing but the code runs perfectly?
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
void Encrypt(char c,int k);
int main(int argc, string argv[])
{
//ensure argc is 2 or fail
if(argc != 2)
{
printf("unsupported number of commandline arguments\n");
printf("Please enter an integer!\n");
return 1;
}
//correct argument run code
else
{
//change key into intager
int k = atoi(argv[1]);
//get input
string input = get_string();
printf("Plaintext: %s\n", input);
//Ensure string value
if(input != NULL)
{
int l = strlen(input);
printf("ciphertext: ");
//loop through input to get characters
for(int i = 0; i < l; i ++)
{
//encrypt
Encrypt(input[i], k);
}
}
}
printf("\n");
return 0;
}
//Encrypt function takes character to change and key from argv[1]
void Encrypt(char c, int k)
{
printf("%c",c + k);
}
Console Error