c/c++语言开发共享数据选择小程序

#include <stdio.h>#include <string.h>void main(){ struct staff { char name[20]; char department[20]; int salary; int cost; }worker[3]= { {"Xu_Guo","pa …

#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);
        }
}

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/c-cdevelopment/608420.html

(0)
上一篇 2021年5月15日
下一篇 2021年5月15日

精彩推荐