I've been fiddling with this for a couple hours and I can't figure out why this keeps prompting twice, i've searched this website and followed up on a few tips like clearing the buffer etc the loop is still prompting twice when it comes back from the function
Please enter the type of person exiting the garage
S or s for Staff. P or p for Patient. G or g for a Guest
Please enter the type of person exiting the garage
S or s for Staff. P or p for Patient. G or g for a Guest
Any advice would he helpful. Here is my code.
#include <stdio.h>
#define SENTINEL -99
double clientC;
double revenue;
char work;
double hours;
int main(void)
{
double hours;
printf("Type E or e when you, the parking operator are ready to clock out of
the day.\n");
int loop = 0;
while (loop != SENTINEL)
{
printf("Please enter the type of person exiting the garage\nS or s for
Staff.\nP or p for Patient.\nG or g for a Guest:");
scanf_s("%c", &work);
if (work == 'e' || work == 'E')
{
printf("The total revenue earned for the day:%.2lf\n", revenue);
loop == SENTINEL;
}
if (work == 's' || work == 'S')
staff();
}
}
int staff(void)
{
double clientC = 2.0;
printf("Please enter the number of hours they were in the parking
garage:\n");
scanf_s("%lf", &hours);
printf("The charge for staff members is $2.00 a day.\n Your charge is
$%.2lf\n", clientC);
revenue +=clientC;
return(0);
}