error: expected unqualified-id before '{' token

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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
 #include "candidates.h"
#include "candidateCollections.h"
#include "states.h"

#include <fstream>


using namespace std;


void primaryElection (istream& input, ostream& output);


int main(int argc, char** argv)
{
  // Main routine - if command parameters give two filenames,
  //  read from the first and write to the second. If not,
  //  read from standard input and write to standard output
  if (argc == 3)
    {
      ifstream in (argv[1]);
      ofstream out (argv[2]);
      primaryElection (in, out);
    }
  else
    primaryElection (cin, cout);

  return 0;
}


// Your code goes below here.  I don't recommend that you make any changes
// above these lines except possibly to the list of #include's

/*
void primaryElection (istream& input, ostream& output);
  readCandidates(input);
  int nStates;

  input >> nStates;
  for (int i = 0; i < nStates; ++i)
    {
      readState(input);
      assignment.assignDelegatesToCandidates();
    }
  for (int i = 0; i < nCandidates; ++i)
    {
      printCandidateReport(output, i);
    }
}
*/





void primaryElection (istream& input, ostream& output);
{
  while (input)
  {
    getline(input,candidateName);
    Candidate candidate (candidateName);
    stateprimary.addCandidate(candidateName,votes);

    cout << candidateName << endl << votes << endl; // for my purpose to see if they're being stored<br>

    totalVotes = totalVotes + votes;
    input >> votes;

    if (votes < 0)
    {
        stateprimary.assignDelegatesToCandidates();//assign delegates to each candidate <br>
        input >> nDelegates;
        input >> votes;
  }
}
    





Okay, so this is my main.cpp. I am trying to run this program but I continue to get two errors; both on line 58. The error is "expected unqualified-id before '{' token" and then "expected ',' or ';' before '{' token.



I backslashed out part of the coding because that was the original part before I had to change it and I wanted to keep it there just incase I needed to reference it later. If I understand it correctly, looking at the orginal code, its expecting me to put a "}" before my function definition primaryelection, but I can't seem to find where that bracket starts at. I'm not supposed to mess with anything in the main.cpp. Any advice on how I'm supposed to fix this error would be greatly appreciated. Also, if you could explain why I have it would be great.


Thanks for your help.
There's a semicolon at the end of line 57 that shouldn't be there.
Topic archived. No new replies allowed.