0
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);

        }

    }
}
3
Contributors
2
Replies
10
Views
3 Years
Discussion Span
Last Post by richieking
0

i wana to initalization all rooms ids and all beds id
once time not every time i run the programmme

Not possible unless you save the info to a text file and re-read it when the program starts. Once the program terminates evrything is lost, just like when you turn your computer off.

0

Also consider xml type as its more structured. Thats depending on your level lol. My favorit here is sqlite but i guess you wont need that for now. Experiment.... keep on.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.