電影資訊管理 檔案操作 單鏈表 標頭檔案

2021-08-18 18:05:44 字數 2104 閱讀 3382

#include 

#include

#include

#include

#include

#include"movie.h"

int movie_count=0;

film *head;

int main()

int menu()

return0;}

void createlink()

head = (film*)malloc(sizeof(film));

head->next=null;

q=head;

fscanf(movies_info,"%d\n",&movie_count);

for(int i=0;iif(i==0)

else

}q->next=null;

fclose(movies_info);

}void addmovie()

pnew = (film*)malloc(sizeof(film));

printf("\n\n\t請輸入編號:");

scanf("%d",&pnew->id);

printf("\n\n\t請輸入影片名:");

getchar();

gets(pnew->name);

printf("\n\n\t請輸入導演名:");

gets(pnew->director);

printf("\n\n\t請輸入主演名:");

gets(pnew->actor);

printf("\n\n\t請輸入上映日期:");

gets(pnew->date);

printf("\n\n\t請輸入評分:");

scanf("%f",&pnew->score);

q=head;

movie_count++;

while(q->next!=null)q=q->next;

q->next=pnew;

q=pnew;

q->next=null;

fprintf(movies_info,"%d\n",movie_count);

q=head->next;

while(q!=null)

fclose(movies_info);

getchar();

printf("\n\n 》按任意鍵回到選單》\n");

getch();

system("cls");

menu();

}void searchmovie()

if(p!=null)

else

}void modifymovie()

if(p!=null)

fprintf(movies_info,"%d\n",movie_count);

p=head->next;

while(p!=null)

fclose(movies_info);

printf("*****====成功修改了編號為%04d的影片資訊!*****====");

}else

} void deletemovie()

if(p->next)

fprintf(movies_info,"%d\n",movie_count);

p=head->next;

while(p!=null)

fclose(movies_info);

} else

}void showallmovies()

else

getchar();

printf("\n 》按任意鍵回到選單》\n");

單鏈表學生資訊管理系統

include include include 一 建立結構體 typedef struct lnode l 定義結構體型別為 l l creat void addlink void findbyid void delbyid void findall void alterinfo l creat ...

單鏈表實現學生資訊管理系統

define crt secure no warnings include include include int count 0 typedef struct student typedef struct node node node createlinklist 建立指標鍊錶 headnode ...

學生資訊管理操作

students 輸出語文成績不及格學生的人數 假設成績為百分制,及格分數為60分 failed chinese num len list filter lambda x x verbal 60,students print failed chinese num 輸出數學成績不及格學生的學號 姓名和...