H
hpy_awad
I wrote that program from a book that my compile that program
correctly under C++ compiler but I got those errors for compiling
under unix !!
Errors-
--------
part10_iti_r01_ch10_verbo_menu_driven_programs.c: In function `main':
part10_iti_r01_ch10_verbo_menu_driven_programs.c:6: warning:
declaration of `argc' shadows a parameter
part10_iti_r01_ch10_verbo_menu_driven_programs.c:7: warning:
declaration of `argv' shadows a parameter
part10_iti_r01_ch10_verbo_menu_driven_programs.c:22: syntax error
before '{' token
Program-
--------
#include <stdio.h>
//part10_iti_r01_ch10_verbo_menu_driven_programs.c
main (argc,argv)
{
int argc;
char *argv[50];
{
int option;
do
{
//Display menu
display_menu();
//Initite appropriate program or exit
if (option!=7) //exit
call_program(option,argv);
}
while (option!=7);
}
display_menu()
{
system("clear");
printf ("\n TV Rental system");
printf ("\n ----------------");
printf("\n\n 1 Set up new customer");
printf("\n\n 2 Change existing customer record");
printf("\n\n 3 Add new customer record");
printf("\n\n 4 Delete customer record");
printf("\n\n 5 Print customer bills");
printf("\n\n 6 display a customer record");
printf("\n\n 7 Exit");
}
user_selection()
{
int opt;
printf("\n\n Enter required option number (1-7) ");
scanf("%d",&opt);
return(opt);
}
call_program(opt,argv)
int opt;
char *argv[];
{
switch(opt)
{
case 1: spawnvp(0,"a.obj",argv);
delay();
break;
defaultrintf("\nError");
delay();
}
}
delay()
{
int i;
for (i=0;i<=20000;++i);
}
correctly under C++ compiler but I got those errors for compiling
under unix !!
Errors-
--------
part10_iti_r01_ch10_verbo_menu_driven_programs.c: In function `main':
part10_iti_r01_ch10_verbo_menu_driven_programs.c:6: warning:
declaration of `argc' shadows a parameter
part10_iti_r01_ch10_verbo_menu_driven_programs.c:7: warning:
declaration of `argv' shadows a parameter
part10_iti_r01_ch10_verbo_menu_driven_programs.c:22: syntax error
before '{' token
Program-
--------
#include <stdio.h>
//part10_iti_r01_ch10_verbo_menu_driven_programs.c
main (argc,argv)
{
int argc;
char *argv[50];
{
int option;
do
{
//Display menu
display_menu();
//Initite appropriate program or exit
if (option!=7) //exit
call_program(option,argv);
}
while (option!=7);
}
display_menu()
{
system("clear");
printf ("\n TV Rental system");
printf ("\n ----------------");
printf("\n\n 1 Set up new customer");
printf("\n\n 2 Change existing customer record");
printf("\n\n 3 Add new customer record");
printf("\n\n 4 Delete customer record");
printf("\n\n 5 Print customer bills");
printf("\n\n 6 display a customer record");
printf("\n\n 7 Exit");
}
user_selection()
{
int opt;
printf("\n\n Enter required option number (1-7) ");
scanf("%d",&opt);
return(opt);
}
call_program(opt,argv)
int opt;
char *argv[];
{
switch(opt)
{
case 1: spawnvp(0,"a.obj",argv);
delay();
break;
defaultrintf("\nError");
delay();
}
}
delay()
{
int i;
for (i=0;i<=20000;++i);
}