2

I tried check50, and I got some message for the command down below.

#include<cs50.h>
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>

int main(int argc, string argv[])
{
    string a = argv[1];
    int s = strlen(a);
    if(s == 0)
    {
    printf("No keyword entered\n");
    return 1;
    }
    for(int k = 0; k < s; k++)
    {
    if(!isalpha(a[k]))
    {
    printf("keyword not alphabetical\n");
    return 1;
    }
    }
    string t = GetString();
    int i = 0;
    int x = 0;
    int v = 65;
    for(int n = strlen(t); i < n; i ++)
    {
        if(isalpha(t[i]))
        {
           if(isupper(t[i]))
           {
              if(isupper(t[i]))
              {
              if(islower(a[x]))
              {
              v = v + 32;
              }
              int p = a[x];
              p = p -v;
              int 1 =t[i];
              1 = 1 - 65;
              int b = (1+ p[s%x]%26;
              b = b + 65;
              char c = b;
              printf("%c", c);
              x = x+1;

            }
            if(islower(t[i]))
            {
               int p = a[x];
               p = p - v;
               int 1 = t[i];
               1 = 1-97;
               int b =(1 +p[s%x]%26;
               b = b + 97;
               char c = b;
               printf("%c", c);
               x = x + 1;
              }
            }
            else
            {
            printf)"%c", t[i]);
            }
         }
         printf('\n');
     }             

Error message: :| encrypts "a" as "a" using "a" as keyword :| encrypts "world, say hello!" as "xoqmd, rby gflkp!" using "baz" as keyword :| encrypts "BaRFoo" as "CaQGon" using "BaZ" as keyword :| encrypts "BARFOO" as "CAQGON" using "BAZ" as keyword :| handles lack of argv[1] :| handles argc > 2 :| rejects "Hax0r2" as keyword

How to fix it all?

user5231181
  • 31
  • 1
  • 7

0 Answers0