am doing my project phase 1  its about hospital :
i have made a person class--patient inherite from it
i wanna afunction to----add,alter,delete
 patient---------------- in text file
the output
1--> add patient
2-->alter patient data
3-->delete a patient
class person{
int id;
string fname;
string lname;
string gender;
int age;
int phone;
public:

    bool get_id(int);
    bool get_fname(string);
    bool get_lname(string);
    bool get_gender(string);
    bool get_age(int);
    bool get_phone(int);
    string set_fname();
    string set_lname();
    string set_gender();
    int set_age();
    int set_phone();
    int set_id();
};

Recommended Answers

All 2 Replies

Do you know how to do file I/O? If not then you need to read a tutorial or your textbook about it. To alter or delete a patient from the text file, the text file has to be completly re-written, there is no way to modify or remove strings from a text file. So you will have to read all the patient data into memory, make whatever changes you need in memory, then rewrite the file.

thank you thank you thank you sir
thats what i have done
thank you again sir

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.