-4
#include <iostream>
#include "proj1.h"
using namespace std;

//Deciphers a message. cip[] is a char array containing a Cipher message                                                            
//as a null-term.                                                                                                                   
void Decipher(char Cip[], char key);
{
  char intCip[];
  char intMessage[];
  char cipher[];
  int intKey = key - 'A';
  for( int i = 0; i < strlen(Cip); i++)
    {
      if(Cip[i] >= 'A' && Cip[i] <= 'Z')
        {
          intCip[i] = key - Cip[i];
        }
    }
  for( int i = 0; i < strlen(Cip); i++)
    {
      Cip[i] = (intCip[i] + (intKey % 26));
    }
}

char SolveCipher(const char Cip[], char dec[]);
{
  return 0;
}

int main()
{
  Decipher (ciper[0], 'R');
  return 0;
}

I get this error message when I try to make the .exe

g++ -Wall proj1.cpp -o program
proj1.cpp:8: error: expected unqualified-id before ‘{’ token
make: *** [program] Error 1

What does this mean? I can't see what I would need before the '{' since that starts the function definition.

Zach Johnson
  • 152
  • 1
  • 8
  • 3
    you have semicolon in this function definition: `char SolveCipher(const char Cip[], char dec[]);` it doesnt belong there – x4rf41 Sep 24 '15 at 03:14
  • It means that the semicolon at the end of the "void Decipher(...)" line is confusing the compiler, and you should remove the semicolon from that line. – Jeremy Friesner Sep 24 '15 at 03:14
  • 1
    After you fix your semicolon typos I suspect your next question will be why `char intCip[];` doesn't compile. Do you have a [good C++ book](http://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) to learn from? – Blastfurnace Sep 24 '15 at 03:22
  • which strange unreadable indentation style is this? – phuclv Sep 24 '15 at 04:42

3 Answers3

1

Remove the semicolon after void Decipher(char Cip[], char key)

phuclv
  • 37,963
  • 15
  • 156
  • 475
user2393256
  • 1,001
  • 1
  • 15
  • 26
1

There is a ; after SolveCipher definition which is causing this error.

Anil Kumar
  • 37
  • 8
1
void Decipher(char Cip[], char key); // notice the semicolon

This means a function prototype declaration. To define a function you need to remove the semicolon

phuclv
  • 37,963
  • 15
  • 156
  • 475