no matching function for call to

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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#include <iostream>
#include<time.h>
#include <stdlib.h>
using namespace std;

enum state {initial_state, qu_landing,arriving, qu_takeoff, departing, crash};
int airplane_id=1;
int queue_id=1;


class Random{ //classe Random***********************************************
public:
Random();
~Random();
int rndm_plane();
};
Random::Random(){}
Random::~Random(){}
int Random::rndm_plane(){
srand(time(NULL));
return rand()%11;
}

class Timer { //classe Timer**********************************************

public:
Timer();
~Timer ();
int begin();
};
Timer::Timer(){}
Timer::~Timer(){}
int Timer::begin(){
bool interval=0;
int rndm;
time_t start,now;
double def = 0;
Random rnd;
time(&start);
do{
time(&now);
def=now-start;
if(def==2){//interval de temps
interval=1;
rndm=rnd.rndm_plane();}
}
while(interval==0);
return rndm;
}



class Airplane{ //classe Airplane*******************************************
public:
int id_plane;
int fuel_unit;
state airplane_state;

public:
Airplane();
~Airplane();
void sort(Airplane);
int land();
int takeoff();
int get_id_plane();
int get_fuel_unit();
state get_airplane_state();
};
Airplane::Airplane(){
this->id_plane=airplane_id;
this->fuel_unit=(rand()%25)+25;
this->airplane_state=qu_landing;

}

Airplane::~Airplane(){}

int Airplane::land(){}
int Airplane::takeoff(){}

void sort(Airplane TAB[100]){
Airplane temp;
for(int i=0;i<100;i++){
for(int j=0;j<100;j++){
if (TAB[j+1].fuel_unit<TAB[j].fuel_unit){
temp=TAB[j];
TAB[j]=TAB[j+1];
TAB[j+1]=temp;}
}}
for(int i=0;i<100;i++){ //afficher tableau
cout<<"TAB["<<i<<"] = "<<TAB[i].id_plane<<endl;
cout<<"TAB["<<i<<"] = "<<TAB[i].fuel_unit<<endl;
cout<<"TAB["<<i<<"] = "<<TAB[i].airplane_state<<endl;}
}
int Airplane::get_id_plane(){}
int Airplane::get_fuel_unit(){}
state Airplane::get_airplane_state(){}





class Landing{ //classe Landing*********************************************
private:
int lqueue_id;
Airplane plane;
int Ltime_access_qu;
int arriving_time;
public:
Landing();
int chk_success_arriv();
int get_size_lqueue();
int pop_lqu();
int give_priority();
int get_lqu_state();
int is_dangerous();

};
/*Landing::Landing(){
this->lqueue_id=queue_id;
this->plane=
this->
this->
}*/


class Takeoff{ //classe Takeoff*********************************************
private:
Airplane plane;
int tqueue;
int tsize_qu;
int ttime_access_qu;
int departure_time;
int tflight_id;
public:
Takeoff();
int push_tqu();
int get_tqu_state();
int get_success_dep();
int pop_tqu();
};
//Takeoff::Takeoff(){}

class queu_manager{ //classe Manager********************************************
private:
Landing arr_lqueue[100];
Takeoff arr_tkfqueue[100];
public:


};


//*****************************************************************************************************************************
int main(){
Timer strt;
int aleat;

Airplane A[100];

int A_indice=0;

Airplane aa;

for(int count=0;count<=2;count++){//nembre d'intervale d'execution de la simul
cout<<"interval "<<count<<endl;
aleat=strt.begin();
cout<<"Random! "<<aleat<<endl<<endl;

for(int x=0;x<=aleat-1;x++){

A[x+A_indice]=aa;
cout<<"A[ "<<x+A_indice<<" ]"<<A[x+A_indice].id_plane<<endl;
cout<<"A[ "<<x+A_indice<<" ]"<<A[x+A_indice].fuel_unit<<endl;
cout<<"A[ "<<x+A_indice<<" ]"<<A[x+A_indice].airplane_state<<endl<<endl;
airplane_id++;}
A_indice+=aleat;}
aa.sort(A);

return 0;
} 











----------------------------------------------

[Error] C:\Documents and Settings\mido.FS-920E66AC3E25\Mes documents\test.cpp:178: no matching function for call to `Airplane::sort (Airplane[100])'

[Error] C:\Documents and Settings\mido.FS-920E66AC3E25\Mes documents\test.cpp:62: candidates are: void Airplane::sort(Airplane)
Last edited on
Would you mind editing your post and putting the source inside code tags? It will make it a lot more legible and folks here will be more likely to look at it.
thks for your comment, i'm new here so i'm sorry for this mistake ;)
1
2
3
4
5
6
7
8
9
10
11
12
class Airplane{
  void sort(Airplane);  //receives one object Airplane
};
//void Airplane::sort(Airplane) missing implementation

void sort(Airplane TAB[100]){ //a function (not a method) that receives an array of size 100

int main(){
  Airplane A[100];
  Airplane aa;
//...
  aa.sort(A); //calling the method that receives just one object 

Is not responsability of an airplane to sort the others. It should be a function. But that already exists so use std::sort(A, A+100, comparator);.
You could overload operator<, make a class with operator() or a function that tells you when an airplane is less than another
thks a lot , it works, i make just function sort and i call it in main() with sort(A)
Topic archived. No new replies allowed.