expected unqualified-id before '{' token

hi,this a program that has two players and one judge.the judge selects a letter and the player who has more letters equal to the one that the judge selected wins.It's been hours since i have this problem and i can't find a solution on the internet.

the error appears in line 8 and 28.

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
#include<iostream>
#include<string.h>
using namespace std;

char CP1[256],CP2[256],letra[1];
int p1,p2,G;
int ganador(int p1,int p2);
{
    if(p1>p2)
    {
     G=1;
    }
    else
    {
        if(p1<p2)
        {
           G=2;  
        }
        else
        {
         G=0;
        }
    }
    return G;
}

void definicion(char* A,char* B);
{
    int longitud=strlen(CP1),longitud2=strlen(CP2),i;
     for(i=0;i=longitud;i++)
     {
          if ( letra[1]=CP1[i])
          {
               p1=p1+1;
               }
     }
     for(i=0;i=longitud2;i++)
     {
          if (letra[1]=CP2[i])
          {
              p2=p2+1;
          }                    
     }
}


int main ()
{
 cout<<"JUGADOR 1:ingrese cadena\n";
 cin>>CP1;
 cout<<"JUGADOR 2:ingrese cadena\n";
 cin>>CP2;
 cout<<"JURADO:ingrese caracter \n";
 cin>>letra;
 definicion(CP1,CP2);
 ganador (p1,p2);
 if (G=0)
    {
    cout<<"EMPATE\n";     
    }
    else
    {
    cout<<" GANADOR JUGADOR "<<G;    
    }
 system("pause");
}
Last edited on
the error appears in line 8 and 28.


Actually, this particular error occurs at the ends of line 7:
int ganador(int p1,int p2);
and line 27:
void definicion(char* A,char* B);
Remove the semi-colons from the ends of these lines.

Take it from there. I'm afraid that there are quite a few more errors to find afterwards.
thanks, the program doesn't run,but at least is one problem less now
Topic archived. No new replies allowed.