#include<iostream>
#include<conio.h>
using namespace std;
struct biodata
{
string fname;
string lname;
string mname;
string address;
string pbirth;
string dbirth;
string religion;
string citizen;
string civilstat;
string gender;
string email;
}*student;
main( )
{
int n,i,xx,c,d,a=0,e=1;
char b,y;
cout<<"how many records?";
cin>>n;
cin.ignore( );
student= new biodata[n];
for(i=0;i<n;i++)
{
cout<<"\nLast name:"<<" ";
getline(cin,student.lname);
cout<<"First name:"<<" ";
getline(cin,student.fname);
cout<<"Middle name:"<<" ";
getline(cin,student.mname);
cout<<"Full Addess:"<<" ";
getline(cin,student.address);
cout<<"Gender:"<<" ";
getline(cin,student.gender);
cout<<"Place of Birth:"<<" ";
getline(cin,student.pbirth);
cout<<"Date of birth"<<" ";
getline(cin,student.dbirth);
cout<<"Citizenship:"<<" ";
getline(cin,student.citizen);
cout<<"Religion:"<<" ";
getline(cin,student.religion);
cout<<"Civil Status:"<<" ";
getline(cin,student.civilstat);
cout<<"Email Address"<<" ";
getline(cin,student.email);
}
cout<<"\n[1]"<<" "<< "VIEW ALL"<<endl;
cout<<"[2]"<<" "<< "VIEW"<<endl;
cout<<"[3]"<<" "<< "ADD"<<endl;
cout<<"[4]"<<" "<< "DELETE"<<endl;
cout<<"[5]"<<" "<< "EXIT"<<endl;
cout<<"\nEnter choice:";
cin>>c;
cin.ignore( );
do
{
do
{
if(c==1)
{
cout<<" "<<"\n\nTHIS IS ALL OF YOUR RECORD"<<endl;
for(i=0;i<n;i++)
{
cout<<"\nNAME:"<<" "<<student.lname<<" "<<student.fname<<" "<<student.mname<<endl;
cout<<"____________________________________________________"<<endl;
cout<<" Surname"<<" "<<" First name"<<" "<<" Middle name"<<endl;
cout<<"\nAddress:"<<" "<<student.address<<endl;
cout<<"Place of Birth:"<<" "<<student.pbirth<<endl;
cout<<"Date of Birth:"<<" "<<student.dbirth<<endl;
cout<<"Email Address:"<<" "<<student.email<<endl;
cout<<"Gender:"<<" "<<student.gender<<endl;
cout<<"Citizenship:"<<" "<<student.citizen<<endl;
cout<<"Civil Status:"<<" "<<student.civilstat<<endl;
cout<<"Religion:"<<" "<<student.religion<<endl;
}
cout<<"\n\nPress b to back to mian menu:";
cin>>b;
if(b=='b'||b=='B')
{
cout<<"\n[2]"<<" "<< "VIEW"<<endl;
cout<<"[3]"<<" "<< "ADD"<<endl;
cout<<"[4]"<<" "<< "DELETE"<<endl;
cout<<"[5]"<<" "<< "EXIT"<<endl;
cout<<"\nEnter choice:";
cin>>c;
cin.ignore( );
}
}
}while(c==1);
do
{
do
{
system("cls");
if(c==4)
{
cout<<"Enter index that you want to delete:"<<" ";
cin>>d;
if(d>=n)
cout<<"\ninvalid!"<<" "<<"no Index found";
else
{
cout<<"\nThe index was successfully deleted:";
a=a+1;
}
cout<<"\n\nPress b to back to mian menu:";
cin>>b;
if(b=='b'||b=='B')
{
cout<<"\n[1]" "New View"<<endl;
cout<<"[2]" "VIEW"<<endl;
cout<<"[3]" "ADD"<<endl;
cout<<"[4]" "DELETE"<<endl;
cout<<"[5]" "EXIT"<<endl;
cout<<"\nEnter choice:";
cin>>c;
cin.ignore( );
}
}
}while(c==4);
do
{
system("cls");
if(c==3)
{
if(a==0)
cout<<"\nSorry the index is full!" "Delete some index to use this Menu";
else
{
{
cout<<"\nLast name:"<<" ";
getline(cin,student[d-a+1].lname);
cout<<"First name:"<<" ";
getline(cin,student[d-a+1].fname);
cout<<"Middle name:"<<" ";
getline(cin,student[d-a+1].mname);
cout<<"Full Addess:"<<" ";
getline(cin,student[d-a+1].address);
cout<<"Gender:"<<" ";
getline(cin,student[d-a+1].gender);
cout<<"Place of Birth:"<<" ";
getline(cin,student[d-a+1].pbirth);
cout<<"Date of birth"<<" ";
getline(cin,student[d-a+1].dbirth);
cout<<"Citizenship:"<<" ";
getline(cin,student[d-a+1].citizen);
cout<<"Religion:"<<" ";
getline(cin,student[d-a+1].religion);
cout<<"Civil Status:"<<" ";
getline(cin,student[d-a+1].civilstat);
cout<<"Email Address"<<" ";
getline(cin,student[d-a+1].email);
a=a-1;
}
}
cout<<"\n\nPress b to back to mian menu:";
cin>>b;
if(b=='b'||b=='B')
{
cout<<"\n[2]" "VIEW"<<endl;
cout<<"[3]" "ADD"<<endl;
cout<<"[4]" "DELETE"<<endl;
cout<<"[5]" "EXIT"<<endl;
cout<<"\nEnter choice:";
cin>>c;
cin.ignore();
}
}
}while(c==3);
}while(c!=2);
if(c==2)
{
cout<<"You choose the VIEW menu please Enter index"<<" ";
cin>>xx;
}
if(xx>=n)
{
cout<<"\ninvalid!"<<" "<<"NO Index found";
}
else
if(xx==d)
{
for(i=d;i<n;i++)
student=student[i-1];
student[i-1];
cout<<" ";
}
else
{
cout<<"\nNAME:"<<" "<<student[xx].lname<<" "<<student[xx].fname<<" "<<student[xx].mname<<endl;
cout<<"____________________________________________________"<<endl;
cout<<" Surname"<<" "<<" First name"<<" "<<" Middle name"<<endl;
cout<<"\nAddress:"<<" "<<student[xx].address<<endl;
cout<<"Place of Birth:"<<" "<<student[xx].pbirth<<endl;
cout<<"Date of Birth:"<<" "<<student[xx].dbirth<<endl;
cout<<"Email Address:"<<" "<<student[xx].email<<endl;
cout<<"Gender:"<<" "<<student[xx].gender<<endl;
cout<<"Citizenship:"<<" "<<student[xx].citizen<<endl;
cout<<"Civil Status:"<<" "<<student[xx].civilstat<<endl;
cout<<"Religion:"<<" "<<student[xx].religion<<endl;
}
cout<<"\n\nPress b to back to mian menu:";
cin>>b;
if(b=='b'||b=='B')
{
cout<<"\n[2]" "VIEW"<<endl;
cout<<"[3]" "ADD"<<endl;
cout<<"[4]" "DELETE"<<endl;
cout<<"[5]" "EXIT"<<endl;
cout<<"\nEnter choice:";
cin>>c;
cin.ignore( );
}
}while(c!=5);
a++;
getch( );
return 0;
}