Write a C++ Program for MAKING FILE PROGRAM WITH USING ALL MODES

//MAKING FILE PROGRAM WITH USING ALL MODES

#include
#include
#include

static int totrec=0; //totrec variable keep track for total variable entered
//Initially Record scanned are Zero

void main()
{
int choice;
while(1)
{
clrscr();
cout<<"Choose your choice\nNOTE : one choice for one record(except viewing data)\n"; cout<<"1) Scanning intial records\n"; cout<<"2) Appending records\n"; cout<<"3) Modifying or append records\n"; cout<<"4) Viewing records\n"; cout<<"5) Exit\n"; cout<<"Enter your choice : "; cin>>choice;
switch (choice)
{
case 1 : {
ofstream outfile;
outfile.open("emp",ios::out);
cout<<"\n\nPlease enter the details as per demanded\n"; cout<<"\nEnter the name : "; char name[20]; cin>>name;
outfile<<<<"Enter Age : "; int age; cin>>age;
outfile<<<<"Enter programming language known by him\her : "; char lang[25]; cin>>lang;
outfile<<<<"\n\nPlease enter the details as per demanded\n"; cout<<"\nEnter the name : "; char name[20]; cin>>name;
outfile<<<<"Enter Age : "; int age; cin>>age;
outfile<<<<"Enter programming language known by him : "; char lang[25]; cin>>lang;
outfile<<<<"Are you interested in adding record\nenter y or n\n"; char ans; cin>>ans;
if(ans=='y' || ans=='Y')
{
cout<<"\n\nPlease enter the details as per demanded\n"; cout<<"\nEnter the name : "; char name[20]; cin>>name;
outfile<<<<"Enter Age : "; int age; cin>>age;
outfile<<<<"Enter programming language known by him : "; char lang[25]; cin>>lang;
outfile<< 0)
{
infile.getline(line,size);
cout<<"\n\nNAME : "<<
infile.getline(line,size);
cout<<"AGE : "<<
infile.getline(line,size);
cout<<"LANGUAGE : "<<
counter--;
}
infile.close();
}
getch();
break;
case 5 : goto out;
default : cout<<"\nInvalid Choice\nTRY AGAIN\n";
}
}
out:
}