Study of structures - 5.

#include <stdio.h>

struct
{
int id;
char name[20], dept[30];
float salary;
}e;

/*typedef struct
{
int id;
char name[20], dept[30];
float salary;
}employee;*/


int main(void)
{
printf("\nEnter info for employee : \n");
printf("\nId : ");
scanf("%d", &e.id);

printf("Name : ");
fflush(stdin);
gets(e.name);

printf("Department : ");
fflush(stdin);
gets(e.dept);

printf("Salary : ");
scanf("%f", &e.salary);

printf( "\nDisplaying employee info : \n");
printf( "\nId : %d", e.id);
printf( "\nName : %s", e.name);
printf( "\nDepartment : %s", e.dept);
printf( "\nSalary : %f", e.salary);

return 0;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin