#include
#include
#include
#include
struct {
int workernumber[10];
char name[18];
char sex[10];
int age[8];
char education[20];
char addr[50];
int tel[20];
float salary[20];
}staff;
FILE*fp;
void Add();
void Search();
void Delete();
void Modify();
void educationway();
void salaryway();
void main()
{
printf("\t\t********** Welcome To The Staff Management System********\n");
printf("\t\t\t********1.Add the information********\n");
printf("\t\t\t********2.Search the infomation********\n");
printf("\t\t\t********3.Delete the information********\n");
printf("\t\t\t********4.Modify the information********\n");
printf("\t\t\t********5.Exit The Staff Management System*********");
printf("\n\n\n\tif you want to add the information,please input 1;");
printf("\n\tif you want to search the information,please input 2;");
printf("\n\tif you want to detele the information,please input 3;");
printf("\n\tif you want to modify the information,please input 4;");
printf("\n\tif you want to exit The Staff Management System,please input 5;\n");
printf("\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t电信09-1Fxxx");
while (1) {
printf("\t\t\tplease input i:");
int i;
scanf("%d",&i);
if(i == 1) {
Add();
}
else if(i == 2) {
Search();
}
else if(i == 3) {
Delete();
}
else if(i == 4) {
Modify();
}
else if(i == 5) break;
else if(i!=1 || i!=2 || i!=3 || i!=4 || i!=5) printf("input error!!!please input again !");
}
}
void Add(){
fp=fopen("d:\\staff.txt","a");
{ printf("\nplease input the information of the staffs\n");
printf("请依次输入:workernumber,name,sex,age,education,addr,tel,salary输入:\n");
scanf("%d%s%s%d%s%s%d%f\n", staff.workernumber,staff.name,staff.sex,staff.age,staff.education,staff.addr,staff.tel,staff.salary);
fprintf(fp,"\n\t\t\t\t公司员工信息:\t%d\t%s\t%s\t%d\t%s\t%s\t%d\t%f\n", staff.workernumber,staff.name,staff.sex,staff.age,staff.education,staff.addr,staff.tel,staff.salary);
printf("\n信息录入成功!!!\n");
}
fclose(fp);
};
|