oh yea sorry
Code:
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
//Start of variables
/* Ppl names */
char name1[20];
char name2[20];
char name3[20];
char name4[20];
char name5[20];
/* Hourly rate */
float hrr1;
float hrr2;
float hrr3;
float hrr4;
float hrr5;
/* Hours worked */
float hrw1;
float hrw2;
float hrw3;
float hrw4;
float hrw5;
/* Amount paid */
float ap1;
float ap2;
float ap3;
float ap4;
float ap5;
/* Taxes paid */
float tp1;
float tp2;
float tp3;
float tp4;
float tp5;
//End of variables
/*START OF FIRST RUN*/
//Start of user input
printf("Employee name:");
scanf("%s", &name1);
fflush(stdin);
printf("Enter hourly rate:");
scanf("%f", &hrr1);
printf("Enter hours worked:");
scanf("%f", &hrw1);
printf("\n");
//End of user input
//Start of equations
if (hrw1>40){
ap1=40*hrr1+(hrw1-40)*(1.5*hrr1);
}
else{
ap1=hrw1*hrr1;
}
tp1=ap1*0.2;
//End of equations
//Start of calculated data
printf("Pay to: %s \n", name1);
printf("Hourly rate: %f \n", hrr1);
printf("Hours worked: %f \n", hrw1);
printf("Amount paid: %f \n", ap1);
printf("Taxes paid: %f \n", tp1);
//End of calculated data
/*END OF FIRST RUN*/
printf("----------------------------------\n");
/*START OF SECOND RUN*/
//Start of user input
printf("Employee name:");
scanf("%s", &name2);
fflush(stdin);
printf("Enter hourly rate:");
scanf("%f", &hrr2);
printf("Enter hours worked:");
scanf("%f", &hrw2);
printf("\n");
//End of user input
//Start of equations
if (hrw2>40){
ap2=40*hrr2+(hrw2-40)*(1.5*hrr2);
}
else{
ap2=hrw2*hrr2;
}
tp2=ap2*0.2;
//End of equations
//Start of calculated data
printf("Pay to: %s \n", name2);
printf("Hourly rate: %f \n", hrr2);
printf("Hours worked: %f \n", hrw2);
printf("Amount paid: %f \n", ap2);
printf("Taxes paid: %f \n", tp2);
//End of calculated data
/*END OF SECOND RUN*/
printf("----------------------------------\n");
/*START OF THIRD RUN*/
//Start of user input
printf("Employee name:");
scanf("%s", &name3);
fflush(stdin);
printf("Enter hourly rate:");
scanf("%f", &hrr3);
printf("Enter hours worked:");
scanf("%f", &hrw3);
printf("\n");
//End of user input
//Start of equations
if (hrw3>40){
ap3=40*hrr3+(hrw3-40)*(1.5*hrr3);
}
else{
ap3=hrw3*hrr3;
}
tp3=ap3*0.2;
//End of equations
//Start of calculated data
printf("Pay to: %s \n", name3);
printf("Hourly rate: %f \n", hrr3);
printf("Hours worked: %f \n", hrw3);
printf("Amount paid: %f \n", ap3);
printf("Taxes paid: %f \n", tp3);
//End of calculated data
/*END OF THIRD RUN*/
printf("----------------------------------\n");
/*START OF FOURTH RUN*/
//Start of user input
printf("Employee name:");
scanf("%s", &name4);
fflush(stdin);
printf("Enter hourly rate:");
scanf("%f", &hrr4);
printf("Enter hours worked:");
scanf("%f", &hrw4);
printf("\n");
//End of user input
//Start of equations
if (hrw4>40){
ap4=40*hrr4+(hrw4-40)*(1.5*hrr4);
}
else{
ap4=hrw4*hrr4;
}
tp4=ap4*0.2;
//End of equations
//Start of calculated data
printf("Pay to: %s \n", name4);
printf("Hourly rate: %f \n", hrr4);
printf("Hours worked: %f \n", hrw4);
printf("Amount paid: %f \n", ap4);
printf("Taxes paid: %f \n", tp4);
//End of calculated data
/*END OF FOURTH RUN*/
printf("----------------------------------\n");
/*START OF FIFTH RUN*/
//Start of user input
printf("Employee name:");
scanf("%s", &name5);
fflush(stdin);
printf("Enter hourly rate:");
scanf("%f", &hrr5);
printf("Enter hours worked:");
scanf("%f", &hrw5);
printf("\n");
//End of user input
//Start of equations
if (hrw5>40){
ap5=40*hrr5+(hrw5-40)*(1.5*hrr5);
}
else{
ap5=hrw5*hrr5;
}
tp5=ap5*0.2;
//End of equations
//Start of calculated data
printf("Pay to: %s \n", name5);
printf("Hourly rate: %f \n", hrr5);
printf("Hours worked: %f \n", hrw5);
printf("Amount paid: %f \n", ap5);
printf("Taxes paid: %f \n", tp5);
//End of calculated data
/*END OF FIFTH RUN*/
printf("----------------------------------\n");
printf("\n");
system("pause");
}/* closing brace */
I need help with fgets. its confusing.