UrgentHomeWork

+1-617-874-1011 (US)
+44-117-230-1145 (UK)
+61-7-5641-0117 (AU)
help@urgenthomework.com
Live chat

Available 24 x 7 Assignment Help

With Tutoring

# Structures and Pointers

#include <stdio.h>
#include <conio.h>
int main()
{
{`//char name_of_company[50];`}
int no_of_employees;
typedef struct{
int employee_id;
char name[50];
char sex;
int salary;
} employee;
employee emp[50];
printf("Create employee database for a company.\n");
printf("Enter the name of company: ");
scanf("%s",name_of_company);
printf("\nEnter no. of employees(Max. limit of 50): ");
scanf("%d",&no_of_employees);
int i=0;
int total=0;
for (i=0;i<no_of_employees;i++)
{
printf("\nEnter employee id: ");
scanf("%d",&emp[i].employee_id);
printf("\nEnter employee name with '-' between names: ");
scanf("%s",emp[i].name);
printf("\nEnter sex of employee(m/f): ");
emp[i].sex = getche();
printf("\nEnter salary of employee: ");
scanf("%d",&emp[i].salary);
total = total + emp[i].salary;
}
printf("\nPrinting database ... ");
printf("\n\t\t%s",name_of_company);
printf("\nNumber of Employees: %d",no_of_employees);
printf("\nTotal Salary of employees: %d",total);
printf("\n----------------------------------");
printf("\nID\tName\t\tSex\tSalary");
for(i=0;i<no_of_employees;i++)
{
printf("\n%d\t%s\t\t%c\t%d",emp[i].employee_id,emp[i].name,emp[i].sex,emp[i].salary);
}
getch();
return;
}

The output is shown below:

### Topics in C Programming

Resources
24 x 7 Availability.
Trained and Certified Experts.
Plagiarism Free.
Privacy Guaranteed.