Thursday, July 21, 2011

Program to make employee payment record using structure

/*Serial No.114     [swami91.cpp]*/

#include<stdio.h>
#include<conio.h>
#include<string.h>
struct employee
    {
    int bs,att;
    char name[10];
    };
struct employee emp[10];
void main()
{
int i;
float ded,da,hra,net,gross,sal;
clrscr();
for(i=1;i<4;i++)
    {
    printf("enter the name of %d employee: ",i);
    scanf("%s",emp[i].name);
    printf("enter the attendence of preset month = ");
    scanf("%d",&emp[i].att);
    printf("enter the basic salary =");
    scanf("%d",&emp[i].bs);
    }

printf("\n\ndata stored are :\n");
for(i=1;i<4;i++)
    {
    printf("Name of %d employee: %s\n",i,emp[i].name);
    sal=(emp[i].bs/30)*emp[i].att;
    da=sal*0.1;
    hra=sal*0.2;
    gross=sal+da+hra;
    ded=gross*0.1;
    net=gross-ded;
    printf("Gross salary =%f\n",gross);
    printf("Net salary =%f\n",net);
    }
getch();
}

No comments:

Post a Comment

If you have any doubt, feel free to ask...