Kindly take look at this code, it is giving me an error in the main function.
#include<iostream.h>
#include<fstream.h>
#include<cstdlib>
#include<cstring>
ofstream re;
class studentinfo
{
private:
char* VUID;
char* campusID;
char* Studentname;
char* Fathername;
public:
void Storefile(char*, char*, char*, char*);
char* Display() ;
studentinfo(char*, char*, char*, char*);
~studentinfo();
};
studentinfo::studentinfo(char* VUID, char* campusID, char* Studentname, char* Fathername)
{
VUID = "mc123456789";
campusID = "sdasdas";
Studentname = "xyxzy ayauu iausui";
Fathername = "sdas asdasd asdas";
cout<<"Contructor Called"<<endl;
}
studentinfo::~studentinfo()
{
cout<<"Destructor Called for destruction of the object"<<endl;
}
void studentinfo::Storefile(char* VUID, char* campusID, char* Studentname, char* Fathername)
{
char* ID;
char* camID;
char* stdntnme;
char* Fthrnme;
re.open("record.txt");
if(!re)
{
cout<<"Error Reading File"<<endl;
}
re<<ID<<endl<<camID<<endl<<stdntnme<<endl<<Fthrnme<<endl;
re.close();
}
char* studentinfo::Display()
{
char* VUID;
char* campusID;
char* Studentname;
char* Fathername;
ifstream re;
re.open("record.txt");
if(!re)
{
cout<<"Error Reading File"<<endl;
}
re>>VUID>>campusID>>Studentname>>Fathername;
cout<<VUID<<endl<<campusID<<endl<<Studentname<<endl<<Fathername<<endl;
re.close();
}
main()
{
studentinfo std1;
std1.Storefile();
std1.Display();
}