1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
| #include<stdio.h>
#include<conio.h>
#include<stdlib.h>
typedef struct
{
char M[10];
char N[12];
char Pr[20];
char SB[6];
char SN[6];
}employe;
employe *table;
table=(employe*)malloc(100,sizeof(employe));
int *i,*NE;
float *TT,*TP,*T,*P;
int main()
{
puts("\tProgramm de calcul des salsires des employes");
printf("Entrer le nombre d'employes");
scanf("%d",NE);
/*Saisie des informations des employes*/
for(*i=0;*i<NE;i++)
{
system("cls");
printf("Informations de l'employe numero %d",*i+1);
printf("Entrer la matricule:");
gets(table+i<-M); /* gets(table[i].M) = scanf("%s",table[i].M) avec table[i] c'est *(table+i) et le . c'est <- */
printf("Entrer le nom:");
gets(table+i<-N);
printf("Entrer le prenom:");
gets(table+i<-Pr);
do
{
printf("Entrer le salaire brut:");
gets(table+i<-SB);
}while(*(table+i<-SB)<0);
}
/*Calcul*/
for(*i=0;*i<NE;i++)
if((*(table+i<-SB)>0)&&(*(table+i<-SB)<=500))
{
*TT=0;
*TP=0.2;
*T=*(table+i<-SB)**TT;
*P=*(table+i<-SB)**TP;
*(table+i<-SN)=*(table+i<-SB)-*T+*P;
}
else
if((*table+i<-SB)>500)&&(*(table+i<-SB)<=3000))
{
*TT=0.17;
*TP=0.3;
*T=*(table+i<-SB)**TT;
*P=*(table+i<-SB)**TP;
*(table+i<-SN)=*(table+i<-SB)-*T+*P;
}
else
{
*TT=0.35;
*TP=0.4;
*T=*(table+i<-SB)**TT;
*P=*(table+i<-SB)**TP;
*(table+i<-SN)=*(table+i<-SB)-*T+*P;
}
for(*i=0;*i<NE;i++)
printf("Le salaire net de l'employe numero %d est : %s\n",*i+1,*(table+i<-SN));
getch();
} |
Partager