• Forum
  • Lounge
  • how to save data from a file into a clas

 
how to save data from a file into a class which is being used as a pointer

i want to coppy the data for example myfile.txt into a class named student which has a different members in it for exaple student name,roll number and password;
how am i able to suppose to put every value differently,
//myfile.txt
TURBO-l3314-ahscsa12
i have to put each value into the private members each student will have different name pass and roll number regardless
class student
{
private:
string name;
string password;
string rollno;
string creation_date;
bool degree_type;
int fee;
int no_of_courses;
Course * courses;


public:
student();
student(const student &s);
student(string nam,string pass,string roll,string cdate,bool dt,int f,Course *stdnt_course,int nofCourses);
~student();
bool Student_logIn(string un,string p);
void view_previous_courses();
bool view_offered_courses(const Semester * &s1,string code);
bool select_course(const Semester * &slist,string course_code);

bool deselect_course(const Semester *&s1,string course_code);
bool confirm_and_save(const Semester * &slist,string course_code);
void view_student_bio();
string get_rollno();
string get_name();
bool get_degree_type();
int get_fee_status();
Course *get_courses();
// the following functions will be accessed only by admin
void set_name();
void set_rollNO();
void set_student_type();
void set_Creation_Date();

};




struct Course
{
string course_name;
string course_code;
int iseats;
int occupied_seats;
bool bcourse_type;
string sPre_req;
string sCourse_timing;
int ifee;


};
struct Semester
{
string starting_date;
string sEnding_date;
string stiming;
int no_of_courses;
Course * list_of_courses;
bool bSem_type;
bool bIs_open;
};
Last edited on
Might have better luck reposting this in the "Beginners" or "General C++" sections. The lounge is typically for non-programming topics, or to just discuss things.

Remember to use code-tags when you repost.
Topic archived. No new replies allowed.