#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<string.h>
struct book
{
char name[50];
int age;
char address[50];
char phn_no[50];
char email[20];
int plan;
int bill;
}e;
struct yoga
{
char name[50];
int age;
char phn_no[50];
char day[20];
int time;
}b;
main()
{
FILE *fp ,*fd;
int a;
char d='y';
char c='y';
clrscr();
printf("**********************WELCOME TO SILVER GYM************************ \n");
printf("please choose any plan \n ");
printf("1) join the gym \n ");
printf("2) know our gym \n ");
printf("3) create a peronal booking with our specialist yoga trainer \n ");
printf("4) display the records \n ");
printf("5) exit \n ");
printf("******************************************************************* \n");
scanf("%d",&a);
if(a==1)
{
clrscr();
fp=fopen("new.dat","w");
if(fp==NULL)
{
printf("sorry cannot open file");
sleep(3);
}
while(d=='y')
{
fflush(stdin);
printf("enter your name \n");
gets(e.name);
printf("enter your age \n ");
scanf("%d",&e.age);
fflush(stdin);
printf("enter your address \n");
gets(e.address);
fflush(stdin);
printf("please enter your phone number \n");
scanf("%s",&e.phn_no);
printf("please enter your email \n ");
scanf("%s",&e.email);
printf("Now please choose any plan \n");
printf("loading please wait for a moment");
sleep(3);
clrscr();
printf("-------------------OUR PLANS-----------------\n");
printf(" PLAN RATE \n");
printf("1) our wieght training plan 1000/permnth \n");
printf("2) cardio plan 800/permnth \n ");
printf("3) wieght loss plan 1000/permnth \n ");
printf("4) special yoga plan 700/permnth \n ");
printf("5) dual(cardio+ wieghtlifting) 1500/permnth \n ");
fflush(stdin);
printf("Please choose any plan \n ");
scanf("%d",&e.plan);
if(e.plan==1)
{
e.bill=1000;
}
else if(e.plan==2)
{
e.bill=800;
}
else if(e.plan==3)
{
e.bill=1000;
}
else if(e.plan==4)
{
e.bill=700;
}
else if(e.plan==5)
{
e.bill=1500;
}
fwrite(&e,sizeof(e),1,fp);
printf("do you want to enter more records (y/n)..");
d=getch();
}
fclose(fp);
}
else if(a==2)
{clrscr();
printf("************************************************************** \n");
printf(" Silver gym brings you a blend of cardio traing and weightlifting together \n ");
printf(" we have a total of 20 qualified and certified trainers always wiling to help \n ");
printf(" \n \n ");
printf(" we are loacted at \t XY2/block-B paschim vihar \n");
printf(" contact us at \t 25210510 \t 9898645 \n");
printf("************************************************************** \n");
sleep(10);
}
else if(a==3)
{
clrscr();
fd=fopen("second.dat","w");
if(fd==NULL)
{
printf("sorry cannot open file");
sleep(5);
exit(0);
}
while(c=='y')
{
fflush(stdin);
printf("creating a personal booking with our yoga specialist MR Amit Grover \n");
printf("\n please wait for a second ...... \n ");
sleep(5);
printf("enter your name \n");
gets(b.name);
printf("enter your age \n");
scanf("%d",&b.name);
printf("enter your phone no \n ");
scanf("%s",&b.phn_no);
printf("we are avaible from monday to saturday \n timing :10 AM to 8PM \n");
printf("please choose day and time accordingly \n");
fflush(stdin);
printf("enter the day for meeting \n");
gets(b.day);
printf("enter the time \n");
scanf("%d",&b.time);
fwrite(&b,sizeof(b),1,fd);
printf("your booking has been fixed ..please be on your selected time \n");
sleep(1);
printf("want to create more bookings (y/n).. \n");
c=getch();
}
fclose(fd);
}
else if(a==4)
{
clrscr();
printf("showing records for new bookings \n");
fp=fopen("new.dat","r");
while(fread(&e,sizeof(e),1,fp)==1)
{
printf(" NAME : %s",e.name);
printf("\n AGE : %d",e.age);
printf("\n ADDRESS : %s",e.address);
printf("\n PHONE NO. : %s",e.phn_no);
printf("\n EMAIL : %s ",e.email);
printf("\n PLAN : %d ",e.plan);
printf("\n RATE : %d ",e.bill);
}
fclose(fp);
sleep(12);
clrscr();
printf("\n showing records for personal bookings with yoga specialist");
fd=fopen("second.dat","r");
while(fread(&b,sizeof(b),1,fd)==1)
{
printf("\n NAME : %s",b.name);
printf("\n AGE : %d",b.age);
printf("\n PHONE NO : %s",b.phn_no);
printf("\n DAY : %s ",b.day);
printf("\n TIME : %d ",b.time);
}
fclose(fd);
sleep(2);
}
else if(a==5)
{
exit(0);
}
else
{
printf("WRONG CHOICE");
sleep(2);
exit(0);
}
}
#include<stdlib.h>
#include<conio.h>
#include<string.h>
struct book
{
char name[50];
int age;
char address[50];
char phn_no[50];
char email[20];
int plan;
int bill;
}e;
struct yoga
{
char name[50];
int age;
char phn_no[50];
char day[20];
int time;
}b;
main()
{
FILE *fp ,*fd;
int a;
char d='y';
char c='y';
clrscr();
printf("**********************WELCOME TO SILVER GYM************************ \n");
printf("please choose any plan \n ");
printf("1) join the gym \n ");
printf("2) know our gym \n ");
printf("3) create a peronal booking with our specialist yoga trainer \n ");
printf("4) display the records \n ");
printf("5) exit \n ");
printf("******************************************************************* \n");
scanf("%d",&a);
if(a==1)
{
clrscr();
fp=fopen("new.dat","w");
if(fp==NULL)
{
printf("sorry cannot open file");
sleep(3);
}
while(d=='y')
{
fflush(stdin);
printf("enter your name \n");
gets(e.name);
printf("enter your age \n ");
scanf("%d",&e.age);
fflush(stdin);
printf("enter your address \n");
gets(e.address);
fflush(stdin);
printf("please enter your phone number \n");
scanf("%s",&e.phn_no);
printf("please enter your email \n ");
scanf("%s",&e.email);
printf("Now please choose any plan \n");
printf("loading please wait for a moment");
sleep(3);
clrscr();
printf("-------------------OUR PLANS-----------------\n");
printf(" PLAN RATE \n");
printf("1) our wieght training plan 1000/permnth \n");
printf("2) cardio plan 800/permnth \n ");
printf("3) wieght loss plan 1000/permnth \n ");
printf("4) special yoga plan 700/permnth \n ");
printf("5) dual(cardio+ wieghtlifting) 1500/permnth \n ");
fflush(stdin);
printf("Please choose any plan \n ");
scanf("%d",&e.plan);
if(e.plan==1)
{
e.bill=1000;
}
else if(e.plan==2)
{
e.bill=800;
}
else if(e.plan==3)
{
e.bill=1000;
}
else if(e.plan==4)
{
e.bill=700;
}
else if(e.plan==5)
{
e.bill=1500;
}
fwrite(&e,sizeof(e),1,fp);
printf("do you want to enter more records (y/n)..");
d=getch();
}
fclose(fp);
}
else if(a==2)
{clrscr();
printf("************************************************************** \n");
printf(" Silver gym brings you a blend of cardio traing and weightlifting together \n ");
printf(" we have a total of 20 qualified and certified trainers always wiling to help \n ");
printf(" \n \n ");
printf(" we are loacted at \t XY2/block-B paschim vihar \n");
printf(" contact us at \t 25210510 \t 9898645 \n");
printf("************************************************************** \n");
sleep(10);
}
else if(a==3)
{
clrscr();
fd=fopen("second.dat","w");
if(fd==NULL)
{
printf("sorry cannot open file");
sleep(5);
exit(0);
}
while(c=='y')
{
fflush(stdin);
printf("creating a personal booking with our yoga specialist MR Amit Grover \n");
printf("\n please wait for a second ...... \n ");
sleep(5);
printf("enter your name \n");
gets(b.name);
printf("enter your age \n");
scanf("%d",&b.name);
printf("enter your phone no \n ");
scanf("%s",&b.phn_no);
printf("we are avaible from monday to saturday \n timing :10 AM to 8PM \n");
printf("please choose day and time accordingly \n");
fflush(stdin);
printf("enter the day for meeting \n");
gets(b.day);
printf("enter the time \n");
scanf("%d",&b.time);
fwrite(&b,sizeof(b),1,fd);
printf("your booking has been fixed ..please be on your selected time \n");
sleep(1);
printf("want to create more bookings (y/n).. \n");
c=getch();
}
fclose(fd);
}
else if(a==4)
{
clrscr();
printf("showing records for new bookings \n");
fp=fopen("new.dat","r");
while(fread(&e,sizeof(e),1,fp)==1)
{
printf(" NAME : %s",e.name);
printf("\n AGE : %d",e.age);
printf("\n ADDRESS : %s",e.address);
printf("\n PHONE NO. : %s",e.phn_no);
printf("\n EMAIL : %s ",e.email);
printf("\n PLAN : %d ",e.plan);
printf("\n RATE : %d ",e.bill);
}
fclose(fp);
sleep(12);
clrscr();
printf("\n showing records for personal bookings with yoga specialist");
fd=fopen("second.dat","r");
while(fread(&b,sizeof(b),1,fd)==1)
{
printf("\n NAME : %s",b.name);
printf("\n AGE : %d",b.age);
printf("\n PHONE NO : %s",b.phn_no);
printf("\n DAY : %s ",b.day);
printf("\n TIME : %d ",b.time);
}
fclose(fd);
sleep(2);
}
else if(a==5)
{
exit(0);
}
else
{
printf("WRONG CHOICE");
sleep(2);
exit(0);
}
}