Here are the details (emailed by my teacher)
This program should only use these header files and it's functions :fstream.h,conio.h,process.h
Its a sports club management program ,with the main menu having the following optons:
(In the top it should written "Sports Club Management Program" )
1.Member
2.Facility
3.Report
4.about us
5.exit
Under the options Member and facility ,There should be the options
1.Add // Adds new memeber/facility information to a file
2.Modify //modifies existing member/facility information from file
3.Delete //Deletes existing member/facility information from file
For entering and retrieving information from file ,there should be two structures for member and facility
In the member structure there should be the following files :
Name: (name of the member)
Member no.: (The number of the member.)
Age:
Sex
Type: (The different member types are trial,premium,and premium lifetime)
AMount paid: (The amount paid by the member)
In the Facility structure there should be :
F number: (the number of the facility)
F name: (the different facilities include Swimming ,Gym,cricket court,golf course and other similar sports from your imagination
Under the option Report ,there should be three more options:
Member Report:Information about all the members ,ie. their name member no,and everything
Facility Report: Same as member report ,display all information
Full Report:
Display all informatin on members and facilities
In the about Us option you must display "This is a Sports Club Management Program Done by Paul ,Vinil and Sandeep "
In the exit option ,exit from the program
This program should be done exactly as said above
WHat i have done so far:
Code:
#include<fstream.h>
#include<conio.h>
#include<process.h>
struct member
{
int memno,age,amt,sn;
char s,ty,st[10],name[20];
};
struct facility
{
int fno;
char fname[20];
}
void main()
{
int ch,n,k;
char c,o,z;
member m[20];
facility f[20];
cout<<"\n main menu";
cout<<"\n 1.member";
cout<<"\n 2.facility";
cout<<"\n 3.report";
cout<<"\n 4.about us";
cout<<"\n 5.exit";
cout<<"\n enter your choice accordingly";
cin>>ch;
switch(ch)
{
case 1:cout<<"\n 1.Member";
cout<<"\n a.add";
cout<<"\n b.modify";
cout<<"\n c.delete";
cout<<"\n enter your choice accordingly";
cin>>c;
switch(c)
{
case a : ofstream ofile;
ofile.open("member")
while(o=='y'||o=='Y')
{
cout<<"\n enter the member number";
cin>>n;
m[n-1].memno=n;
cout<<"\n enter the member name";
cin>>m[n-1].name;
cout<<"\n enter the member age";
cin>>m[n-1].age;
cout<<"\n enter the member sex(m/f)";
cin>>m[n-1].s;
cout<<"\n Membership type";
cout<<"\n l-life time";
cout<<"\n p-premium";
cout<<"\n t-trial";
cout<<"\n enter your choice accordingly";
cin>>m[n-1].ty;
switch(m[n-1].ty)
{
case l:m[n-1].amt=25000;
cout<<"\n amount=Rs25,000/-";
break;
case p:m[n-1].amt=250;
cout<<"\n amount=Rs250/-per month";
break;
case t:m[n-1].amt=25;
cout<<"\n amount=Rs25/-for a day";
break;
default:cout<<"\nwrong choice";
}
cout<<"\n enter sports type";
cin>>m[n-1].st;
ofile.write((char*)&m[n-1],sizeof(m[n-1]));
cout<<"\n do you want to continue";
cin>>o;
}
break;
case b:cout<<"\n enter the member no";
cin>>k;
cout<<"\n enter the new name";
cin>>m[k-1].name;
cout<<"\n enter age";
cin>>m[k-1].age;
cout<<"\n enter sex(m/f)";
cin>>m[k-1].s;
cout<<"|n member ship type";
cout<<"\n l-life time";
cout<<"\n p-premium";
cout<<"\n t-trial";
cout<<"\n enter your choice accordingly";
cin>>m[k-1].ty;
switch(m[k].ty)
{
case l:m[k-1].amt=25000;
cout<<"\n total amount=Rs25000/-";
break;
case p:m[k-1].amt=250;
cout<<"amount=250/- per month \n";
break;
case t:m[k-1].amt=25;
cout<<"\n amount=25/- per day";
break;
}
cout<<"enter sports type /n";
cin>>m[k-1].st;
ofile.write((char*)m[k],sizeof(m[k]));
break;
case c:cout<<"enter member number /n"
cin>>f;
ifstream ifile;
ifile.open("member");
ifile.read((char*)m[f],sizeof(m[f]));
cout<<"\n are you sure you want to delete this member(y\n)";
cin>>j;
while(j=='y'||j=='Y')
{
m[f-1].ty=0;
m[f-1].name=0;
m[f-1].age=0;
m[f-1].s=0;
m[f-1].amt=0;
m[f-1].st=0;
}
break;
}
case 2:cout<<"2.facility \n";
cout<<"\n the existing facilities are:";
ofstream ofile1;
ofile1.open("facility");
cout<<"a.add \n";
cout<<"b.modify \n";
cout<<"c.delete \n";
cin>>q;
switch(q)
{
case a: h=0;
while(z=='y'||z=='Y')
{
cout<<"\n enter new facility";
cin>>ft[h].fname;
ft[h].fno=h+1;
cout<<"do you want to continue (y/n) /n";
cin>>z;
ofile.write((char*)ft[h],sizeof(ft[h]));
h++;
}
break;
case b:


