0
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();
};
2
Contributors
2
Replies
15
Views
3 Years
Discussion Span
Last Post by pro.soltan
0

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.

0

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

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.