error in passing class array to function // undefined reference

its showing error 129
undefined reference to ifclassacceptsthatcode(int, int, class_code)


#include <iostream>
#include <time.h>
#include <cstdlib>

using namespace std;

class class_code{

public:
unsigned int prd[5][5] , std , sub[6][2];
char div;
int cstatus[5][5]; // 0 free, -1 occupied

class_code()
{
for (int i=0; i<5 ; i++)
{
for (int j=0; j<5 ; j++)
{
cstatus[5][5] = 0;
}
}
for (int i=0; i<6 ; i++)
{
sub[i][1] = 0;
}
}
};

class t_code{


unsigned int checkintime;

public:
char name[30];
unsigned int sub_code,teachercode;
int period[5][5];
int status[5][5]; // 0 free, -1 occupied

t_code()
{
for (int i=0; i<5 ; i++)
{
for (int j=0; j<5 ; j++)
{
status[i][j] = 0;
}
}
}
void initialize()
{
unsigned int x ;
cin>>checkintime;
x = checkintime;
cout<<"enter teacher code";
cin>>teachercode;
x = x-1;
if (x>0)
{
for (int i=0; i<5 ; i++)
{
for (int j=0; j<checkintime ; j++)
{
status[i][j] = -1;
}
}
}
}
};



int ifclassacceptsthatcode(int,int, class_code);
int check(int , int, class_code);
int itseemsokwithteacher(int , int , int ,t_code );
int generate();
int noft;

int main()
{
cout<< "__college"<<endl;
cout<<"codes for subjects"
<<"\n 001 maths \n 002 phy \n 003 chem \n 004 bio \n 005 cs \n 006 eng \n 007 pe \n008 bst \n009 acc \n010pt";

cout<<"enter no of teachers"; // getting teacher details
cin>>noft;
t_code t[noft];
for (int i =0; i<noft; i++)
{
cout<<"enter teacher name";
cin>>t[i].name;
cout<<"enter subj code ";
cin>>t[i].sub_code;
cout<<"enter checkin time";
t[i].initialize();
}

cout<<"enter class details"; // getting class details
cout<<"enter no of classes";
int noc;
cin>>noc;
class_code c[noc];
for (int i=0; i<noc;i++)
{
cout<<"enter std and div";
cin>>c[i].std>>c[i].div;
cout <<"enter subject codes";
for (int j=0; j<6 ; j++ )
{
cin>>c[j].sub[j][0];
}
}


int x;
srand(time(0));

for (int k=0;k<noc;k++)
{
for (int i=0 ; i<6;i++)
{
for (int j=0;j<4;j++)
{
label:
{
x = generate();

int y = ifclassacceptsthatcode(x,k, c[noc]) ;
if (y = 77)
goto label;
else
y = y;

int a = check(y,k,c[noc]);
if (a = 77)
goto label;
else
a = a;

int f = itseemsokwithteacher( a, i, j, t[noft]);
if (f = 77)
goto label;
else
f = f;

{
c[k].cstatus[i][j] = a;
t[f].status[i][j] = -1;
t[f].period[i][j] = k;
for (int i=0; i<6;i++)
{
if (a == c[k].sub[i][0]){
int e = c[k].sub[i][1];
e++;
}
}
}
}
}
}
}

}


int ifclassacceptsthatcode(int k,int j,class_code c[])
{
for (int i=0; i<6;i++)
{
if (k == c[j].sub[i][0])
return k;
else
return 77;
}
}


int check(int k,int j,class_code c[])
{
for (int i=0; i<6;i++)
{
if (k == c[j].sub[i][0])
{
if (k == 1 || k ==2 || k==3 || k==4 || k==5 || k== 7 || k==9)
{
if (c[j].sub[i][1] < 7)
return k;
else
return 77;
}
if (k == 6)
{
if (c[j].sub[i][1] < 5)
return k;
else
return 77;
}
if (k == 10)
{
if (c[j].sub[i][1] < 2)
return k;
else
return 77;
}
}
}
}

int itseemsokwithteacher(int y, int a, int b, t_code t[])
{
int i = 0;
while(i <= noft)
{
if (t[i].sub_code == y)
{

if (t[i].status[a][b] == 0)
{
return i;
}
else
{
i++;
continue;
}
}
else if (i = noft)
return 77;
else
{
i++;
continue;
}
}
}



int generate()
{
int z = 1 + rand() % 10;
return z;
}
1
2
int ifclassacceptsthatcode (int, int, class_code); //declaration, line 75
int ifclassacceptsthatcode (int k, int j, class_code c[]) //definition, line 169 
¿spot the difference?
yeah thanks :)
Topic archived. No new replies allowed.