How to call struct if it has a boolean type

Hello, I'm new to programming, and I have a question for you:
Here is a part of my code:


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
  struct Tversenyzo {
    bool achieved_minpoint=true;
    bool participated=false;
};
int beolvasas(const string text, int min , int max)
{
bool hiba;
string s;
int e;
do{
cout<<text;
cin>>e;
hiba=cin.fail();

if(hiba)
{cerr<<"Hibas a beirt adat, irja be ujra! "<<endl;
cin.clear();
}
getline(cin,s);

}while(hiba || e>max || e<min);




}
void beolvasas( int &n, int &m, int min[], int &vsz, int &vid, int &vpont, Tversenyzo szampar[100][100] )
{

n=beolvasas("Please type in the number of players:",1,100);
m=beolvasas("Please type in the number of races:",1,100);
for(int i=0; i<m; ++i)
{
    min[i]=beolvasas("Please type in the minimum points for each race:",0,60);
}
 for(int i=0; i<n; i++){
        vsz=beolvasas("Please type in the number of players in the [i+1]. race::",1 ,n);
        for(int j=0; j<vsz; j++ ){
 
            vid=beolvasas("Please type in the number of the player: ",1 ,100);                     vpont=beolvasas("Please type in the points achieved by the player:",1 ,n);
            szampar[vid].participated=true;
            if(vpont<min[i])
            {
                szampar[vid].achieved_minpoint=false;
            }
        }
    }


}
int main()
{


  int versenyekszama, versenyzokszama;
       /* cin >> versenyzokszama;
        cin >> versenyekszama;
        int minpont[versenyekszama];
        for (int i=0; i<versenyekszama; i++) {
            cin >> minpont[i];
        }*/
    Tversenyzo versenyzok[versenyzokszama+1];

    Tversenyzo szampar[100][100];

    int vsz, vid, vpont;
beolvasas(versenyzokszama,versenyekszama,minpont,vsz,vid,vpont, szampar);

Put the code you need help with here.

It doesnt work because it says:|In function 'void beolvasas(int&, int&, int*, int&, int&, int&, Tversenyzo (*)[100])':|
C:\Users\petyaboss\Downloads\main (4).cpp|45|error: request for member 'indult' in '*(szampar + ((sizetype)(((unsigned int)vid) * 200u)))', which is of non-class type 'Tversenyzo [100]'|

I dont know how to call structures if it has a boolean in it.
I hope you can understand what I'm telling you :D
Tversenyzo szampar[100][100]; is a 2D array.

At line 41:
 
    szampar[vid].participated=true;
there is only one subscript [vid] but there should be two.

Either
 
    szampar[vid][something].participated=true;
or
 
    szampar[something][vid].participated=true;

and similar at line 44.
Last edited on
Topic archived. No new replies allowed.