Having a problem when the user selects 1 and enters the info then presses 2 to display the info it is displaying garbage. I know it is because if the if statements, but I can't think of a way to resolve the problem. Any help would be appreciated.





struct employee {

float rate;
float hours;
float gross;
float tax;
float net;
};
#include<stdio.h>
int menu();
struct employee info(void);
void display(struct employee);
int main()
{
int sel;
struct employee emp;
sel = menu();
if(sel== 1)
emp = info(), main();
if (sel == 2)
struct employee emp;
display (emp);


return 0;
}
struct employee info(void)
{
float hours;
float rate;
float gross;
float tax;
float net;
struct employee emp;
printf("Enter employee's payrate: ");
scanf("%f", &rate);
printf("Enter employee's hours worked: ");
scanf("%f", &hours);
emp.hours = hours;
emp.rate= rate;
gross = hours * rate;
emp.gross = gross;
tax = gross * .21;
emp.tax = tax;
net = gross * .79;
emp.net = net;
return emp;
}


int menu()
{ int sel;

puts("Menu\nPress 1 to input data\nPress 2 to display data\nPress 0 to Quit");
scanf("%d", &sel);
if (sel>2)
puts("\aInvalid Selection"), menu();
return sel;
}

void display(struct employee emp)

{
puts("Name SSN Gross Pay Taxes Net");
printf("%6.2f %6.2f %6.2f", emp.gross, emp.tax, emp.net);

}