#include %26lt;iostream.h%26gt;
#include %26lt;conio.h%26gt;
#include %26lt;string.h%26gt;
class Student
{
private:
char *id;
char *Name;
char *father_name;
public:
Student(char* i,char* na,char* fn)
{
int len1=strlen(i);
id=new char[len1+1];
strcpy(id,i);
int len=strlen(na);
Name=new char[len+1];
strcpy(Name,na);
int len2=strlen(fn);
father_name=new char[len2+1];
strcpy(father_name,fn);
}
void Display()
{
cout%26lt;%26lt;"Student ID : "%26lt;%26lt;id;
cout%26lt;%26lt;"\n\nStudent Name : "%26lt;%26lt;Name;
cout%26lt;%26lt;"\n\nStudent Father Name : "%26lt;%26lt;father_name;
}
};
void main()
{
clrscr();
char *name,*fname,*id;
cout%26lt;%26lt;"Enter Student Name : ";
cin%26gt;%26gt;name;
cout%26lt;%26lt;"Ente Father Name : ";
cin%26gt;%26gt;fname;
cout%26lt;%26lt;"Enter ID : ";
cin%26gt;%26gt;id;
cout%26lt;%26lt;endl%26lt;%26lt;endl;
Student s(id,name,fname);
s.Display();
getch();
}
My question is that how can I write the Student object in file as whole and read it from file and to some extent searching an object from file function. Give me brief history of all functions, which your good self will use in the program and also tell me about the book, which can help me completely regarding File Handling in C++.
Urgent Required Help?
Too complicated for Yahoo Answers.
Sorry!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment