After inputting the hourly wage, the compiler spits out the first and second printf, what methods could I use to fix this? Feel free to give any other feedback if some of this code is sloppy, I'm pretty new to programming right now so I might just be making a lotta rookie moves.
struct employee
{
char name[20];
float hours;
float payrate;
float basepay;
float overtimepay;
float grosspay;
float taxespaid;
float netpay;
};
int prompt(struct employee *ptrfiveemployees);
int main()
{
int ret;
struct employee fiveemployees[5];
for(int i = 0; i < 5; i++)
{
ret = prompt(&fiveemployees[i]);
if(ret != 0)
{
printf("Error");
}
}
}
int prompt(struct employee *ptrfiveemployees)
{
printf("Please enter the name of your employee.\n");
fgets(ptrfiveemployees->name, 20, stdin);
printf("Now enter the number of hours they worked.\n");
scanf("%f", &(ptrfiveemployees->hours));
printf("Now enter the hourly wage they are paid.\n");
scanf("%f", &(ptrfiveemployees->payrate));
return 0;
}