15. /*有一个职工基本信息管理,职工信息包含:职工号、姓名、工资;编写完整程序,实
现如下功能:
(1)录入函数input:从键盘读入职工信息。(3分)
(2)修改函数modify:给定职工号,查找该职工,若找到修改其信息,若找不到,给出
错误提示。(4分)
(3)插入函数insert:假定表中职工信息按职工号升序排列,任意给定一职工信息,
使得插入后依然有序。(6分)
(4)输出函数output:输出所有人的信息。(2分)
主函数以菜单形式调用以上功能,类型定义2分,主函数3分。
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define MAXLEN 100
typedef struct
{ char no[8] , name[10];
float sal;
} DataType;
typedef struct
{ DataType data[MAXLEN+1];
int len;
}SeqList;
/*从键盘读入所有职工的信息*/
void input(SeqList*L)
{ int i;
printf("input the length\n");
scanf("%d",&L->len);
printf("input no,name,sal\n");
for(i=1;i<=L->len;i++)
scanf("%s%s%f",L->data[i].no,L->data[i].name,&L->data[i].sal);
本内容试读结束,登录后可阅读更多
下载后可阅读完整内容,剩余3页未读,立即下载