what's up guys?
ummm can u take a look to my program please
class SLList;
class student
{
char FullName [100];
float FinalMark ;
int ArrayOfWishes[3];
student *next;
public:
student();
student(char[],float,int[]);
student(const student&);
~student();
void set_name(char[]);
void set_final_mark(float);
void set_wishes(int,int,int );
friend class SLList;
friend void print(student&);
friend void AccepteInWill(student&,int);
const char* getName(){return FullName;}
float getMark(){return FinalMark;}
int getWish(int a){return ArrayOfWishes[a];}
};
class SLList
{
student*head;
public:
SLList();
~SLList();
void AddToList(student*);
bool IsEmpty();
};
void AccepteInWill(student&,int);
void test_vality_of_wish(int,int,int,int,int,int,int,int,int,int);
#include"bona.h"
#include < iostream >
#include < cstring >
using namespace std;
student::student()
{
FullName[100]=NULL;
FinalMark=NULL;
ArrayOfWishes[3]=NULL;
next=NULL;
}
student::student(char name[],float mark,int a[])
{
set_name(name);
set_final_mark(mark);
set_wishes(a[0],a[1],a[2]);
next=NULL;
}
student::student(const student&s)
{
strcpy(FullName,s.FullName);
FinalMark=s.FinalMark;
ArrayOfWishes[0]=s.ArrayOfWishes[0];
ArrayOfWishes[1]=s.ArrayOfWishes[1];
ArrayOfWishes[2]=s.ArrayOfWishes[2];
}
student::~student()
{
for(int i=0;i<sizeof(fullname);i++)>
FullName[i]=NULL;
FinalMark=0;
for(int i=0;i<3;i++)
ArrayOfWishes[i]=0;
}
void student::set_name(char name[])
{
strcpy(FullName,name);}
void student::set_final_mark(float mark)
{
if(mark>=60&&mark<=100)
FinalMark=mark;
else
throw invalid_argument("invalid mark");
}
void student::set_wishes(int a1,int a2,int a3)
{
if((a1>=1&&a1<=8)&&(a2>=1&&a2<=8)&&(a3>=1&&a2<=8))
{
ArrayOfWishes[0]=a1;
ArrayOfWishes[1]=a2;
ArrayOfWishes[2]=a3;
}
else throw invalid_argument("wish number 1,wish number 2 or/and wish number 3 are invalid input");
}
SLList::SLList()
{
head=NULL;
}
SLList::~SLList()
{
student*i=head;
while(!IsEmpty())
{
i=i->next;
delete i;
head=i;
}
}
bool SLList::IsEmpty()
{
if(head=NULL)
return true;
else
return false;
}
void SLList::AddToList(student*s)
{
if(IsEmpty())
head=s;
else
{
student*i,*j;
i=head;
j=i->next;
while(j!=NULL)
{
if(((s->getMark()) >( i->getMark()) )&&((s->getMark()) <( j->getMark())))
{
s->next=j;
i->next=s;
}
}
}
}
void test_vality_of_wish(int u,int a,int b,int c,int d,int e,int f,int g,int h,int q,student& i)
{
if(u<=3)
{
static int j1=1,j2=1,j3=1,j4=1,j5=1,j6=1,j7=1,j8=1,j9=1;
switch(i.getWish(u))
{
case (1):
if(j1<=a)
{
AccepteInWill(i,1);
j1=j1+1;
}
else
test_vality_of_wish(u+1,a,b,c,d,e,f,g,h,q,i);
break;
case(2):
if(j2<=b)
{
AccepteInWill(i,2);
j2=j2+1;
}
else
test_vality_of_wish(u+1,a,b,c,d,e,f,g,h,q,i);
break;
case(3):
if(j3<=c)
{
AccepteInWill(i,3);
j3=j3+1;
}
else
test_vality_of_wish(u+1,a,b,c,d,e,f,g,h,q,i);
break;
case(4):
if(j4<=d)
{
AccepteInWill(i,4);
j4=j4+1;
}
else
test_vality_of_wish(u+1,a,b,c,d,e,f,g,h,q,i);
break;
case(5):
if(j5<=e)
{
AccepteInWill(i,5);
j5=j5+1;
}
else
test_vality_of_wish(u+1,a,b,c,d,e,f,g,h,q,i);
break;
case(6):
if(j6<=f)
{
AccepteInWill(i,6);
j6=j6+1;
}
else
test_vality_of_wish(u+1,a,b,c,d,e,f,g,h,q,i);
break;
case(7):
if(j7<=g)
{
AccepteInWill(i,7);
j7=j7+1;
}
else
test_vality_of_wish(u+1,a,b,c,d,e,f,g,h,q,i);
break;
case(8):
if(j8<=h)
{
AccepteInWill(i,8);
j8=j8+1;
}
else
test_vality_of_wish(u+1,a,b,c,d,e,f,g,h,q,i);
break;
}
}
}
#include<iostream>
#include"bona.h"
using namespace std;
int main()
{
int a=0,b=0,c=0,d=0,e=0,f=0,g=0,h=0,all_student=0;
student*wishNumber1=new student[a];
student*wishNumber2=new student[b];
student*wishNumber3=new student[c];
student*wishNumber4=new student[d];
student*wishNumber5=new student[e];
student*wishNumber6=new student[f];
student*wishNumber7=new student[g];
student*wishNumber8=new student[h];
student*Denied_student=new student[(all_student-a-b-c-d-e-f-g)];
return 0;
}
my problem is: as u can see the function test_vality_of_wish needs more than three parameters , and i tried to use the (extern) keyword but it didnt work
i'm kinda lost .
can anyone give any advice .