write a program to create a binary file name emp.bin containing the name, address, phone number, and salary of n employees whose salary is less than 10000.
Answers
Answered by
1
Answer:
/*C program to read and print employee's record using structure*/
#include <stdio.h>
/*structure declaration*/
struct employee{
char name[30];
int empId;
float salary;
};
int main()
{
/*declare structure variable*/
struct employee emp;
/*read employee details*/
printf("\nEnter details :\n");
printf("Name ?:"); gets(emp.name);
printf("ID ?:"); scanf("%d",&emp.empId);
printf("Salary ?:"); scanf("%f",&emp.salary);
/*print employee details*/
printf("\nEntered detail is:");
printf("Name: %s" ,emp.name);
printf("Id: %d" ,emp.empId);
printf("Salary: %f\n",emp.salary);
return 0;
}
Similar questions
English,
4 months ago
Math,
4 months ago
History,
8 months ago
Math,
8 months ago
Social Sciences,
1 year ago
Business Studies,
1 year ago