

i 'm doing my assignment but i have some problem with this.can anyone help me to solve this problem .
here is my code:
Code:
#include<fstream.h>
#include<stdlib.h>
class variable
{
protected:
struct student
{
char name[100],course[100],id[10],gender;
int dob,mob,yob,age,ic;
double cgpa,marks[10];
}std[100];
int i;
};
class student:public variable
{
private:
public:
void reg()
{
i=1;
std[i].dob=std[i].mob=std[i].yob=0;
cout<<"Enter Student Name : ";
cin.ignore();
cin.getline(std[i].name,100);
cout<<"Enter Student IC : ";
cin.ignore();
cin>>std[i].ic;
cout<<"Enter Student Gender : ";
cin.ignore();
cin>>std[i].gender;
cout<<"Enter Student Course : ";
cin.ignore();
cin.get(std[i].course,100);
cout<<"Student Borthday : "<<endl;;
cout<<"Date : ";
cin.ignore();
cin>>std[i].dob;
cout<<"Month : ";
cin.ignore();
cin>>std[i].mob;
cout<<"Year : ";
cin.ignore();
cin>>std[i].yob;
i++;
}
void dpl()
{
for(int a=1;a<=i;a++)
{
cout<<"Student Name : "<<std[a].name<<endl;
cout<<"Student ID : "<<std[a].id<<endl;
cout<<"Student IC : "<<std[a].ic<<endl;
cout<<"Student Gender : "<<std[a].gender<<endl;
cout<<"Student Course : "<<std[a].course<<endl;
cout<<"Student Birthday : "<<std[a].dob<<"/"<<std[a].mob<<"/"<<std[a].yob<<endl;
cout<<"============================================="<<endl;
}
}
};
class exam:public student
{
};
class slt_menu:public exam
{
private:
int choice;
char reply;
public:
void mainmenu()
{
cout<<"\t\t\t*******************************************"<<endl;
cout<<"\t\t\t* Extreme Technology *"<<endl;
cout<<"\t\t\t* Collage *"<<endl;
cout<<"\t\t\t* Student Detail System *"<<endl;
cout<<"\t\t\t*******************************************"<<endl;
cout<<"\n\t\t\t1.Student Data System"<<endl;
cout<<"\t\t\t2.Student Examination System"<<endl;
cout<<"\t\t\t3.Exit From This Program"<<endl;
cout<<"\n\t\t\tEnter Your Choice : ";
do{
cin>>choice;
switch(choice)
{
case 1:
{
smenu();
break;
}
case 2:
{
cout<<"****";
break;
}
case 3:
{
exit(1);
break;
}
default:
{
cout<<"\t\t\tYou Have Enter Invalid Input!!!Enter Again!!!"<<endl;
cout<<"\t\t\tEnter Your Choice Again : ";
}
}
}
while(choice!=1 || choice !=2 ||choice !=3);
}
void smenu()
{
student st;
cout<<"\t\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"\t\t\t~ Student Data ~"<<endl;
cout<<"\t\t\t~ System ~"<<endl;
cout<<"\t\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<<endl;
cout<<"\n\t\t\t1.Student Registration"<<endl;
cout<<"\t\t\t2.Display Student Detail"<<endl;
cout<<"\t\t\t3.Seacrh Student Detail"<<endl;
cout<<"\t\t\t4.Return To Main Menu"<<endl;
cout<<"\n\t\t\tEnter YOur Choice : ";
cin>>choice;
do{
switch(choice)
{
case 1:
{
do{
reg();
cout<<"Do You Wish To Add More Data??"<<endl;
cin>>reply;
}while(reply=='Y'||reply=='y');{}
cout<<"Do You Want To Save & Return To Main Menu"<<endl;
cin>>reply;
if(reply=='Y'||reply=='y')
{
ofstream input("student_details.txt");
input.write((char*)&st,sizeof(student));
input.close();
mainmenu();
}
break;
}
case 2:
{
ifstream toread("student_details.txt");
toread.read((char*)&st,sizeof(student));
while(toread)
{
toread.read((char*)&st,sizeof(student));
}
toread.close();
dpl();
}
case 3:
{
}
case 4:
{
mainmenu();
}
default:
{
cout<<"\t\t\tYou Have Enter Invalid Input!!!Enter Again!!!"<<endl;
cout<<"\t\t\tEnter Your Choice Again : ";
cin>>choice;
}
}
}while(choice!=1||choice!=2||choice!=3||choice!=4);
}
};
void main()
{
slt_menu m;
m.mainmenu();
}
can anyone help me ???