#include<stdio.h>
#include<stdlib.h>
int main(){
struct compay{
char name[10];
int hour;
double pay;};
struct company employee[5];
double salary[5];
int i;
for(i=0;i<5;i++){
printf("Enter No.%d employee's name: ",i+1);
scanf("%s",employee[i].name);
printf("Enter No.%d employee's hour: ",i+1);
scanf("%d",&employee[i].hour);
printf("Enter No.%d employee's pay for one hour: ",i+1);
scanf("%lf",employee[i].pay);
}
for(i=0;i<5;i++){
salary[i]=employee[i].hour*employee[i].pay;
printf("%-10s 的薪水為 %.2f\n",employee[i].name,employee[i].salary[i]);
}
system("pause");
return 0;
}
沒有留言:
張貼留言