Hi guys,
A good day to you all!
I am trying to bulid a simple data base but two errors at compile time apparently are
holding me back from running my program. I have tried to figure them out but my efforts are are proving worthless and that's why am turning to you guys right here.
The first error is a "declaration syntax error"
The second says"declaration is not allowed here".
I did try to check out the help menu and the suggestions just couldn't work out.I am using borland c++ 5.02
void main(void)
{
char invite;
printf("^^^^^^^^^^YOSSARIAN'S CAR RENTAL^^^^^^^^^^\n");
printf("Hi,please Welcome!\n");
printf("To proceed,please press C, to quit hit X:\n");
scanf("%c",&invite);
if(invite=='c')
mainmenu();
else
{
printf("Thank you for visiting!");
getch();
}
void mainmenu(void)///this is where it says declaration not allowed
{/////this is where it indicates syntax declaration error
char choice;
while(choice)
{
clrscr();
printf("\n\t\t*****************************");
printf("\n\t\tStudent Administration System" );
printf("\n\t\t Main Menu");
printf("\n\t\t*****************************\n");
printf("\n\t\tA.Add customer details");
printf("\n\t\tB.View customer records");
printf("\n\t\tC.Search for customer records");
printf("\n\t\tD.Modify customer records");
printf("\n\t\tE.Delete Customer details");
printf("\n\t\tF.Exit the system!");
printf("\n");
printf("\n\t\t*****************************\n");
printf("\n\t\t Enter Your Choice [1 - 6]: ");
//printf("\n\t\t*****************************");
scanf("%c", &choice);
switch(choice)
{
char category;
case 'A':
printf("For tourist select T, L for loyalty or O for others:\n");
category==getchar();
if(getchar()=='T'||'t')
addcustomer_rec();
else if(getchar()=='L'||'l')
addcustomer_rec();
else if(getchar()=='O'||'o')
addcustomer_rec();
else printf("End of the road!");
break;
There are three categories of customers in a structure of which I create a function so as to accept customer details without having to rewrite the same code for @ category e.g name.tourist,name.loyal and name.others
e.g function: cus_details(struct customer loyal,tourist,others)
To enter these details I would have to write something like,
printf("Enter first name:");
scanf("%c",f_name.loyal)///what would I have to do so to write a function that can enter details automatically for all the three categories?
Cheers everbody!