資源簡介
C/C++ 學(xué)生信息管理系統(tǒng) 數(shù)組 C/C++ 學(xué)生信息管理系統(tǒng) 數(shù)組

代碼片段和文件信息
#include?
#include?
#include?
struct??DATA
{
int?year;
int?month;
int?day;
};
struct?SCORE
{
int?math;
int?chinese;
int?english;
};
struct?STUDENT
{
char?name[20];
char?sex[3];
????DATA??data;
????SCORE?score;
????struct?STUDENT?*next;
};
#define?MEM?(struct?STUDENT?*)malloc(sizeof(struct?STUDENT))
void?msg();
void?msg_in();
void?msg_find();
//void?read();
void?msg_add();
void?msg_delete();
void?msg_replace();
void?msg();
void?find_by_name();
void?ave();
void?num();
void?paixu();
void?read()
{
struct?STUDENT?*head*tmp*p;
head=NULL;
tmp=NULL;
p=NULL;
??
FILE?*fp;
fp=fopen(“student““rb“);
if(fp==NULL)
{
printf(“打開失敗\n“);
}
else
{??
int?n;
tmp=MEM;
n=fread(tmpsizeof(struct?STUDENT)1fp);
???
if(n==1)
{
head=tmp;
tmp=tmp->next;
}
while(n==1)
//while(!feof(fp))
??{?
tmp=MEM;
n=fread(tmpsizeof(struct?STUDENT)1fp);????????
tmp=tmp->next;
??}?
}
tmp=MEM;
tmp=NULL;
????
?tmp=head;
?printf(“------------------------------------------------------------\n“);
?????printf(“姓名\t性別\t生日\t\t語文\t數(shù)學(xué)\t英語\n“);
?while(tmp!=NULL)
?{
?printf(“%s\t%s\t%d-%d-%d\t%d\t%d\t%d\n“tmp->nametmp->sextmp->data.year
tmp->data.monthtmp->data.daytmp->score.chinesetmp->score.mathtmp->score.english);
?tmp=tmp->next;
?}
?fclose(fp);
}
int?readall()
{
struct?STUDENT?*head;
?head=MEM;
????int?i=0;
FILE?*fp;
fp=fopen(“student““rb“);
if(fp==NULL)
{
printf(“打開失敗\n“);
}
else
{
?????
??while(!feof(fp))
??{
fread(headsizeof(struct?STUDENT)1fp);
head->next=MEM;
head=head->next;
i++;
??}?
}
fclose(fp);
return?(i-1);
}
void?msg_add()
{
??struct?STUDENT?*tmp;
????????
??printf(“------------------------------------------------------------\n“);
????????tmp=MEM;
????????printf(“請(qǐng)輸入姓名:“);
scanf(“%s“&tmp->name);
printf(“請(qǐng)輸入性別:“);
scanf(“%s“&tmp->sex);
printf(“請(qǐng)輸入生日年份:“);
scanf(“%d“&tmp->data.year);
????????printf(“月:“);
scanf(“%d“&tmp->data.month);
printf(“日:“);
scanf(“%d“&tmp->data.day);
printf(“請(qǐng)輸入語文分?jǐn)?shù):“);
scanf(“%d“&tmp->score.chinese);
printf(“請(qǐng)輸入數(shù)學(xué)分?jǐn)?shù):“);
scanf(“%d“&tmp->score.math);
????printf(“請(qǐng)輸入英語分?jǐn)?shù):“);
scanf(“%d“&tmp->score.english);
printf(“顯示輸入的信息:\n“);
printf(“------------------------------------------------------------\n“);
????????printf(“姓名\t性別\t生日\t\t語文\t數(shù)學(xué)\t英語\n“);
printf(“%s\t%s\t%d-%d-%d\t%d\t%d\t%d\n“tmp->nametmp->sextmp->data.year
tmp->data.monthtmp->data.daytmp->score.chinesetmp->score.mathtmp->score.english);
????
printf(“------------------------------------------------------------\n“);
printf(“是否保存文件?1.是?2.返回上層\n“);
printf(“------------------------------------------------------------\n“);
????????int?e;
scanf(“%d“&e);
?????if(1==e)
?{
??????????FILE?*fp;
??fp=fopen(“student““a+b“);
??
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件??????50176??2011-09-02?20:44??學(xué)生信息管理系統(tǒng)?數(shù)組\學(xué)生信息管理系統(tǒng).ncb
?????文件????????960??2011-08-31?21:15??學(xué)生信息管理系統(tǒng)?數(shù)組\學(xué)生信息管理系統(tǒng).plg
?????文件????????557??2011-08-04?21:54??學(xué)生信息管理系統(tǒng)?數(shù)組\學(xué)生信息管理系統(tǒng).dsw
?????文件????????208??2011-08-31?21:14??學(xué)生信息管理系統(tǒng)?數(shù)組\student
?????文件???????3527??2011-08-06?11:48??學(xué)生信息管理系統(tǒng)?數(shù)組\學(xué)生信息管理系統(tǒng).dsp
?????文件??????41984??2011-08-31?21:15??學(xué)生信息管理系統(tǒng)?數(shù)組\Debug\vc60.idb
?????文件??????53248??2011-08-31?21:15??學(xué)生信息管理系統(tǒng)?數(shù)組\Debug\vc60.pdb
?????文件?????492544??2011-08-31?21:15??學(xué)生信息管理系統(tǒng)?數(shù)組\Debug\學(xué)生信息管理系統(tǒng).pdb
?????文件??????????0??2011-08-31?21:15??學(xué)生信息管理系統(tǒng)?數(shù)組\Debug\學(xué)生信息管理系統(tǒng).sbr
?????文件?????222316??2011-08-31?21:13??學(xué)生信息管理系統(tǒng)?數(shù)組\Debug\學(xué)生信息管理系統(tǒng).pch
?????文件?????196685??2011-08-31?21:15??學(xué)生信息管理系統(tǒng)?數(shù)組\Debug\學(xué)生信息管理系統(tǒng).exe
?????文件??????23566??2011-08-31?21:15??學(xué)生信息管理系統(tǒng)?數(shù)組\Debug\學(xué)生信息管理系統(tǒng).obj
?????文件?????201352??2011-08-31?21:15??學(xué)生信息管理系統(tǒng)?數(shù)組\Debug\學(xué)生信息管理系統(tǒng).ilk
?????文件??????50176??2011-08-31?21:15??學(xué)生信息管理系統(tǒng)?數(shù)組\Debug\學(xué)生信息管理系統(tǒng).bsc
?????文件???????6480??2011-08-31?21:15??學(xué)生信息管理系統(tǒng)?數(shù)組\學(xué)生信息管理系統(tǒng).cpp
?????文件??????48640??2011-09-02?20:44??學(xué)生信息管理系統(tǒng)?數(shù)組\學(xué)生信息管理系統(tǒng).opt
?????目錄??????????0??2011-08-14?14:40??學(xué)生信息管理系統(tǒng)?數(shù)組\Debug
?????目錄??????????0??2011-08-14?14:40??學(xué)生信息管理系統(tǒng)?數(shù)組
-----------?---------??----------?-----??----
??????????????1392419????????????????????18
評(píng)論
共有 條評(píng)論