0

I'm having issues on how to start the shift value part of this assignment. I've gotten the first part of the assignment and making sure the argc is indeed a word or letter and not an integer. Could anyone help me work it out, so I can learn how to approach this in the future and this assignment? My first step would be to break the shift value down in two steps by 1 single letter and a phrase. But would it be beneficial to try and combine both single letter and phrases with an equation or better to try and break it down the problem?

// takes single character as an input
int shift(char c);
int main(int argc, string argv[])
{
    // checking the argument if the statement has 2 arguments
    if (argc != 2)
    {
        printf("Usage: ./vigenere keyword ");

        return 1;
    }
    else
    {
        // making sure the keyword is A-Z 
        for (int i = 0, n = strlen(argv[1]); i < n; i++)
        {
            // if it is not alphabetical 
            if (!isalpha(argv[1][i]))
            {
                printf("Usage: ./vigenere keyword ");

                return 1;
            }
        }

    }
    // asking for the plaintext to be encoded by the key 
    string p = get_string("plaintext: ");
    printf("ciphertext: ");
    // storing the key 






}

1 Answer 1

0

I am not sure what you mean by combining a single letter and a phrase. The vignette is similar to the Cesar cipher. There is a key and a word that needs to be encrypted. If you manage to encrypt it all with one number let’s say change hello then you just need to create a variable that houses the key and changes according to how many times the key has been used or what location it is at. There are many other approaches but a good start is to make a simple encryption code that changes everything like the Caesar by one simple key and then make the key more complex.

You must log in to answer this question.

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