i wanna ahelp please
hospital project
i have made aclass room composed of 4(class bed)
i wana to initalization all rooms ids and all beds id
once time not every time i run the programmme
example room 1 ---->bed1,bed2,bed3
// bed class <<---
class bed{
int id;
bool empty;
public:
bed();
void set_bedid(int);
int get_bedid();
bool is_empty();
void take_bed();
};
void bed::set_bedid(int num)
{
this->id=num;
}
int bed::get_bedid()
{
return this->id;
}
bed::bed()
{
empty=true;
}
bool bed::is_empty()
{
return this-> empty;
}
void bed::take_bed()
{
empty=false;
}
// romm class <<---
class room{
int id;
public:
bed arrayofbeds[4];
void set_roomid(int);
int get_roomid();
};
void room::set_roomid(int number){
this->id=number;
}
int room::get_roomid(){
return this->id;
}
were can i do this 4 loop
class branch---hava an ---room arrayofroom[10];
void branch::initalization(branch x){
for(int i=0;i<10;i++)
{
for(int j=0;j<4;j++)
{
x.arrayofrooms[i].set_roomid(i+1);
x.arrayofrooms[i].arrayofbeds[j].set_bedid(j+1);
}
}
}
pro.soltan 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.