資源簡(jiǎn)介
學(xué)生信息管理系統(tǒng),壓縮包有源碼,程序,報(bào)告。聲明:本人只是用來(lái)學(xué)習(xí)。

代碼片段和文件信息
/*copyright(c)2018.燕京理工學(xué)院信息科學(xué)與技術(shù)學(xué)院?
?*?All?rights?reserved?
?*?文件名稱(chēng):demo.Cpp?
?*?作者:路朋澤
?*?完成日期:2018年9月19日?
?*?版本號(hào):codeblock?
?*?
?*?問(wèn)題描述:??學(xué)生信息管理系統(tǒng)
?*?輸入描述:?
?*?程序輸出:?輸出結(jié)果?
?*/??
?
#include?
#include?
#include?
#include?
#include?
#?define?LEN?sizeof(struct?Student)
struct?Student?{
char?num[100];?????????????????//學(xué)號(hào)
char?name[200];???????????????//姓名
char?sex[100];???????????????//性別
int?age;????????????????????//年齡
char?phone[120];???????????//電話(huà)
char?address[120];????????//地址
char?birthday[200];??????//生日
char?mail[200]?;????????//郵件
struct?Student?*next;
};
void?menu();
void?start();
void?welcome();
char?filename[30];//全局變量,用來(lái)保存要打開(kāi)的文件名字
struct?Student?*Creat(int?n);
//生成鏈表
struct?Student?*Creat(int?n)
{
????void?menu_print_in(void);
????struct?Student?*head;
????struct?Student?*p1?*p2;
?
????system(“cls“);
????for(int?i=1;i ????????p1?=?(struct?Student*)malloc(LEN);
????????menu_print_in();
????????scanf(“%s%s%s%d%s%s%s%s“p1->nump1->namep1->sex
????????&p1->agep1->phonep1->addressp1->birthdayp1->mail);
????????p1->next?=?NULL;
????????if(i==1)
{
????????????head?=?p2?=?p1;
????????}
????????else?{
????????????p2->next?=?p1;
????????????p2?=?p1;
????????}
????}
????return(head);
}
?
//數(shù)據(jù)存盤(pán)(wb只寫(xiě))
void?WriteData_wb(struct?Student?*head)?{
????FILE?*fp;
????struct?Student?*p;
????if((fp?=?fopen(filename?“wb“))==NULL)
????printf(“\a?文件打開(kāi)錯(cuò)誤“);
????p?=?head;
????while(p!=NULL)?{
????????if(fwrite(pLEN1fp)!=1)?{
????????????printf(“寫(xiě)入數(shù)據(jù)出錯(cuò)\n“);
????????????fclose(fp);
????????????return;
????????}
????????p=p->next;
????}
????fclose(fp);
}
?
//數(shù)據(jù)存盤(pán)(ab追加)
void?WriteData_ab(struct?Student?*head)
{
????FILE?*fp;
????struct?Student?*p;
????if((fp?=?fopen(filename?“ab“))==NULL)
????printf(“\a?文件打開(kāi)錯(cuò)誤!“);
????p?=?head;
????while(p!=NULL)?{
????if(fwrite(pLEN1fp)!=1)?{
????????????printf(“寫(xiě)入數(shù)據(jù)出錯(cuò)\n“);
????????????fclose(fp);
????????????return;
????????}
????????p=p->next;
????}
????fclose(fp);
}
?
?
//讀取數(shù)據(jù)文件保存到鏈表中?,返回指向此鏈表頭指針
struct?Student?*ReadData(void)
{
????struct?Student?*head?=?NULL;
????struct?Student?*p1?*p2;//s?=?p1;p?=?p2;
?
????FILE?*fp;
????if((fp=fopen(filename“rb+“))==NULL)
????{
????????printf(“打開(kāi)文件出錯(cuò)\n“);
????????exit(0);
????}
????while(!feof(fp))?{
????????if((p1=(struct?Student*)malloc(LEN))==NULL){
????????????printf(“內(nèi)存申請(qǐng)出錯(cuò)\n“);
????????????fclose(fp);
????????????exit(0);
????????}
????????if(fread(p1LEN1fp)!=1){
????????????free(p1);
????????????break;
????????}
????????if(head==NULL)
????????head=p2=p1;
????????else{
????????????p2->next=p1;
????????????p2=p1;
????????}
????}
????fclose(fp);
????return?(head);
}
?
//全部查詢(xún)
void?display()
{
????system(“cls“);
????void?menu_print_out(void);
????struct?Student?*p;
????p?=?ReadData();
????menu_print_out();
????do
????{
????????printf(“%-10s%6s%8s%4d%13s%11s??%4s??%4s“
?屬性????????????大小?????日期????時(shí)間???名稱(chēng)
-----------?---------??----------?-----??----
?????目錄???????????0??2018-09-25?08:58??數(shù)據(jù)結(jié)構(gòu)課設(shè)\數(shù)據(jù)結(jié)構(gòu)\
?????文件???????14174??2018-09-19?15:34??數(shù)據(jù)結(jié)構(gòu)課設(shè)\數(shù)據(jù)結(jié)構(gòu)\StudentDemo.cpp
?????文件??????141570??2018-09-19?15:36??數(shù)據(jù)結(jié)構(gòu)課設(shè)\數(shù)據(jù)結(jié)構(gòu)\StutendDemo.exe
?????文件????????1056??2018-09-19?15:37??數(shù)據(jù)結(jié)構(gòu)課設(shè)\數(shù)據(jù)結(jié)構(gòu)\student.txt
?????文件?????????148??2018-10-15?20:21??數(shù)據(jù)結(jié)構(gòu)課設(shè)\數(shù)據(jù)結(jié)構(gòu)\使用說(shuō)明.txt
?????文件??????280064??2018-10-15?20:19??數(shù)據(jù)結(jié)構(gòu)課設(shè)\數(shù)據(jù)結(jié)構(gòu).doc
?????目錄???????????0??2018-10-15?20:19??數(shù)據(jù)結(jié)構(gòu)課設(shè)\
評(píng)論
共有 條評(píng)論