0

I have spent hours trying to figure out why my vigenere check50 does not completely work and I was wondering if anyone here could help me.

    string k = argv[1];     
    //iterates through the string and encodes the cipher
    string plaintext = GetString();
    for (int i = 0, r = 0, n = strlen(plaintext);i < n; i++)
    {
        int m = strlen(k);
        int cipherup;
        int cipherlow;
        if (isupper(k[r % m]))
        { 
            cipherup = (k[r % m] - 'A') % 26;
        }    
        else if (islower(k[r % m]))
        {        
            cipherlow = (k[r % m] - 'a') % 26;
        }    
        else
        {    
            printf("cmon son!\n");
            return 1;
        } 

        if (isupper(plaintext[i]))
        {    
            encode
            r++;
        }    
        else if (islower(plaintext[i]))
        {
            encode
            r++;

I think all my logic is correct but check50 tells me: enter image description here

What am I doing wrong?

1
  • Include your complete code, I think there is a validation wrong in you code.and yes, you are really close! Sep 6 '15 at 7:11
0

The first error is possibly because of some error in the encoding code . One of them is possibly, an inclusion of '\n' when not required. The second error is because you need to check the validity of keyword before taking the input

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .