csripriya1
Programmer
Hi I am new to C++ programing. I have probelm in reading data from a file.
I have declared a class like this
class person
{
private:
char *name ;
int age, phone_number;
float wage;
public:
void write_class()
{
cout<< "Name :"<<this.name;
cout <<" Age:" << this.age;
cout <<"wage:"<< this.wage;
}
};
I want to read the data(a class) from a file like this
Jhon 27 500.35
James 32 680.32
.......
where first column gives the name, second gives the age, third gives wages.
Can you pl tell me how to do this.I am using Visual C++ for compiling and running my programs
Thanks for your time and help.
I have declared a class like this
class person
{
private:
char *name ;
int age, phone_number;
float wage;
public:
void write_class()
{
cout<< "Name :"<<this.name;
cout <<" Age:" << this.age;
cout <<"wage:"<< this.wage;
}
};
I want to read the data(a class) from a file like this
Jhon 27 500.35
James 32 680.32
.......
where first column gives the name, second gives the age, third gives wages.
Can you pl tell me how to do this.I am using Visual C++ for compiling and running my programs
Thanks for your time and help.