91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 7KB
    文件類型: .zip
    金幣: 2
    下載: 0 次
    發布日期: 2024-01-20
  • 語言: C/C++
  • 標簽: 鏈表??文件??

資源簡介

這是我在大一學C語言的時候自己寫的一個職工信息管理系統,用了鏈表和文件

資源截圖

代碼片段和文件信息

#include?
#include
#include
struct?employee
{
char?num[10];???????//職工號
char?name[18];??????//姓名
????char?sex[2];????????//性別
char?id[20];????????//身份證號
char?address[20];???//地址
????char?tel[12];???????//電話
char?salary[6];?????//工資
char?department[15];?//部門
char?xl[15];?????????//學歷
????char?password[10];???//密碼
struct?employee?*next;
}em;??????????????//定義一個結構體
char?Num[10];?//記錄登錄者的賬戶號
int?k;?????????//記錄登錄者的身份
void?menu_2();
void?menu_3();

struct?employee?*create(void)???//新建鏈表
{
???
????char?num[10];???????
????char?name[18];?????
????????char?sex[2];???????
????char?id[20];???????
???? char?address[20];???
????????char?tel[12];???????
????char?salary[6];?????
???? char?department[15];?
????char?xl[15];?????????
????????char?password[10];???
int?i=0ncount=0;
int?size=sizeof(struct?employee);
struct?employee?*head*tail*p;
head=tail=NULL;
printf(“請輸入你要錄入的人數:“);
scanf(“%d“&n);
??for(i=0;i {?
??printf(“請輸入職工號:?“);
?????????scanf(“%s“num);
?????????printf(“請輸入姓名:?“);
?????????scanf(“%s“name);
?????????printf(“請輸入性別(f--女?m--男):?“);
?????????scanf(“%s“sex);
?????????printf(“請輸入身份證號:?“);
?????????scanf(“%s“id);
?????????printf(“請輸入地址:?“);
?????????scanf(“%s“address);
?????????printf(“請輸入電話:?“);
?????????scanf(“%s“tel);
?????????printf(“請輸入工資:?“);
?????????scanf(“%s“salary);
?????????printf(“請輸入部門:?“);
?????????scanf(“%s“department);
?????????printf(“請輸入學歷:?“);
?????????scanf(“%s“xl);
?????????printf(“默認密碼為職工號:?“);
?????????strcpy(passwordnum);
?????????printf(“\n“);
?????????count=count+1;
?????????printf(“已增加的人數:\n“);
?????????printf(“%d\n“count);
??????????p=(struct?employee?*)malloc(size); ?
??strcpy(p->numnum);??
??strcpy(p->namename);
??strcpy(p->sexsex);
??strcpy(p->idid);
??strcpy(p->addressaddress); ??
??strcpy(p->teltel);
??strcpy(p->salarysalary);
??strcpy(p->departmentdepartment);
??strcpy(p->xlxl);
??strcpy(p->passwordpassword);

??p->next=NULL;
?
??if(head==NULL)
??head=p;
??else
tail->next=p;
??tail=p;
??????
}

return(head);
}

void?save_1(struct?employee?*head)?//保存職工文件函數
{
?FILE?*fp;
?????struct?employee?*h*q;
?????q=h=head;
?????if((fp=fopen(“employee_list.txt““w“))==NULL)?//創建文件并判斷是否能打開
?{
????????printf?(“cannot?open?file\n“);
????????exit(0);
?}
? ??

??while(h!=NULL)
??{????
??
??fprintf(fp“%s?%s?%s?%s?%s?%s?%s?%s?%s?%s?“h->numh->nameh->sexh->idh->addressh->telh->salaryh->departmenth->xlh->password);
??
?????//fwrite(hsizeof(struct?employee)1fp);
??h=h->next;
??}
??
????fclose(fp);
????free(h);
free(q);
}
void?save_2(struct?employee?*head)?//保存管理員文件函數
{
?FILE?*fp;
?????struct?employee?*h*q;
?????q=h=head;
?????if((fp=fopen(“admin_list.txt““w“))==NULL)?//創建文件并判斷是否能打開
?{
????????printf?(“cannot?open?file\n“);
????????exit(0);
?}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2011-06-12?16:26??職工信息管理系統(C?鏈表)\
?????文件?????????229??2010-12-04?15:57??職工信息管理系統(C?鏈表)\admin_list.txt
?????文件?????????306??2010-12-04?15:56??職工信息管理系統(C?鏈表)\employee_list.txt
?????文件???????31456??2010-12-05?13:41??職工信息管理系統(C?鏈表)\main.c

評論

共有 條評論