Code:
#include <stdio.h>#include <stdlib.h>
int sale_menu();
int report_menu();
void QtrReport();
int sale_menu()
{
int menu;
printf("Sales Processing System\n");
printf("-----------------------\n\n");
printf("1. Add Salesman Records\n");
printf("2. Reports Generation\n");
printf("3. Modify Salesman Records\n");
printf("4. Delete Salesman Records\n\n");
printf("0. Exit\n");
printf("Your choice: ");
scanf("%d", &menu);
return menu;
printf("\n");
}
int report_menu()
{
int report;
printf("Reports Generation\n");
printf("------------------\n\n");
printf("1. View Quarterly Sales Report\n");
printf("2. View Individual Salesman Commission\n\n");
printf("0. Return to Main Menu\n");
printf("Your choice: ");
scanf("%d", &report);
return report;
}
void QtrReport()
{
printf("QtrReport\n");
}
// function main begins program execution
void main()
{
// variable declaration
int getMenu = 0, getReport = 0;
// call sale_menu function
getMenu = sale_menu();
printf("\n");
// if getMenu = 1, call AddSalesMan function
switch(getMenu)
{
case 1:
break;
case 2:
report_menu();
switch (getReport = report_menu())
{
case 1:
QtrReport();
break;
}
break;
}
system("pause");
}
select 2 then 1 two times to test it.
Why view Quarterly Sales Report function need to insert 2 times in order to execute? Can solve the issue without using pointer?