void decryption() //this function decrypts whatever the user inputs using keys 1 - 100, providing all possible decryptions
     const int MAX = 100;
     string code, output;
     char array[100];
     cout << "Enter what you would like decrypted" << endl;
     cin >> code; //herein lies the problem
     strcpy(array, code.c_str());
     for (int key = 0; key <= 100; key++)
         for (int i = 0; i <= strlen(code.c_str()); i++)
             if (array[i] - key < 32) 
                 output += ((array[i] - key) + 127) - 32;
                 output += (array[i] - key);
         cout << "Output using key " << key << ": " << output << endl;

This is my code so far, it all works fine except that the cin >> code takes in the '\n' newline character when I dont want it to.
I've tried using
cin.ignore(1000, '\n');
getline (cin, code);
to get around the problem but it does the same thing as the cin >> code;

What can I do to fix this?

Thank you.

No, cin >> does not take in the newline.
Your problem is the processing loop

for (int i = 0; i <= strlen(code.c_str()); i++)

Running your loop to <= string length means you are processing the NULL terminator at the end of the string.
Loops for handling strings should be written as

for (int i = 0; i < strlen(code.c_str()); i++)

And, you don't need to use the strlen and c_str with the string type, it has its own size or length methods, like code.length()

This question has already been answered. Start a new discussion instead.