Code:
void main()
{
char emp[30], id[10];
int days, ot;
float rate, bp, oot, gp, np, sss, phil, pag;
int x, y, choice;
clrscr();
g(5,15); p("Employee's name: ");
g(5,16); p("ID number: ");
g(5,17); p("Rate per day: ");
g(50,15); p("Days: ");
g(50,16); p("Overtime: ");
g(22,15); gets(emp);
g(22,16); gets(id);
g(22,17); s("%f", &rate);
g(60,15); s("%d", &days);
g(60,16); s("%d", &ot);
gp = grosspay(rate, days, ot);
sss = ssscom(gp);
pag = pagcom(gp);
phil= philcom(gp);
np = netpay(gp, sss, phil, pag);
g(5,20); p("Your net pay is: %.3f ", np);
g(5,22); p("Do you want to see the breakdown? [1] YES [2] NO : ");
g(58,22); s("%d", &choice);
if(choice==1)
{
bp = rate*days;
oot= (1.25*(rate/8))*ot;
g(28,27); p("EMPLOYEE'S WAGE INFORMATION");
g(5,29); p("Employee: %s", emp);
g(5,30); p("ID number: %s", id);
g(5,31); p("Rate per day: P %.2f", rate);
g(50,29); p("Days: %d", days);
g(50,30); p("Overtime: %d", ot);
g(20,35); p("-EARNINGS-");
g(5,37); p("Basic pay: P %.3f", bp);
g(5,38); p("Overtime: P %.3f", oot);
g(5,41); p("Grosspay: P %.3f", gp);
g(50,35); p("-DEDUCTIONS-");
g(38,37); p("SSS: P %.3f", sss);
g(38,38); p("PAGIBIG: P %.3f", pag);
g(38,39); p("PhilHealth: P %.3f", phil);
g(38,41); p("Netpay: P %.3f", np);
This is where i want to ask if a user wants to run this block of code again, if answered YES.
}
else if(choice==2)
{
clrscr();
for(x=31;x<=51;x++)
{
g(x,23); p("Í");
g(x,25); p("Í");
}
g(31,24); p("º");
g(51,24); p("º");
g(31,23); p("É");
g(51,23); p("»");
g(31,25); p("È");
g(51,25); p("¼");
g(32,24); p("Thank you, goodbye!");
}
else
{
clrscr();
g(33,24); p("Invalid Input!");
Here also
}
getch();
}