Compiler error on line 12?

How can I fix my compiler error on line 12 of me code? It's not working for some reason. May I have feedback please?

This is the problem:

Your country is at war and your enemies are using a secret code to communicate
with each other. You have managed to intercept a message that
reads as follows:

:mmZ\dxZmx]Zpgy

Write a program that decrypts the intercepted message. You only know
that the key used is a number between 1 and 100. Your program should
try to decode the message using all possible keys between 1 and 100.
When you try the valid key, the message will make sense. For all other
keys, the message will appear as gibberish.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <iostream>
#include <string>
#include <vector>

using namespace std;

void input(char message[100], int& key);
vector<char> encrypt(char message[100], int key);

int main()
{
    input(message[100], key);
    vector<char> encrypt(char message[100], key);

    return 0;
}

void input(char message[100], int& key)

{
    cout << "Please enter an encrypted message: \n";
    cin.getline(message,100);
}

vector<char> encrypt(char message[100], int key)

{
    int counter;
    char output[100];

    for(key = 1; key <= 100; key++)
    {
        for(counter = 0; message[counter]! = '\0' ; counter++)
        {
            if(message[counter] - key < 32)
                output[counter] = message[counter] - key - 32 + 127;
            else
                output[counter] = message[counter] - key;
        }

        cout << "Decrypted message using Key" << key << " : ";
        cout << output << endl;
    }

}
Last edited on
You're getting a compiler error because you have not defined message or key.
In main, before you call the input function, you need to have those variables defined.
Topic archived. No new replies allowed.