数据选择小程序
#include <stdio.h>
#include <string.h>
void main()
{
struct staff
{
char name[20];
char department[20];
int salary;
int cost;
}worker[3]=
{
{"xu_guo","part1",800,200},
{"wu_xia","part2",1000,300},
{"li_jun","part3",1200,350}
};
int i;
char xname[20];
printf("\ninput the worker\'s name:");
scanf("%s",xname);
for(i=0;i<3;i++)
if(strcmp(xname,worker[i].name)==0)
{
printf("* * * * %s * * * *",xname);
printf("\n salary:%6d",worker[i].salary);
printf("\n cost:%6d",worker[i].cost);
printf("\n payed:%6d",worker[i].salary-worker[i].cost);
}
}
上一篇: 爆笑之这波男女不简单
下一篇: PHP中上传多个文件的表单设计例子