当前位置:首页 > 代码 > 正文

数据结构学生管理系统源代码(学生管理系统架构)

admin 发布:2022-12-19 23:34 183


本篇文章给大家谈谈数据结构学生管理系统源代码,以及学生管理系统架构对应的知识点,希望对各位有所帮助,不要忘了收藏本站喔。

本文目录一览:

求C语言源代码 题目 学生成绩管理系统

#include cstdlib

#include iostream

using namespace std;

int main(int argc, char *argv[])

{ #define UP 72

#define DOWN 80

#define INSERT 82

#define DEL 83

#define ENTER 28

#define KEY 12

#define KEY 23

#define KEY 34

#define KEY 45

#define KEY A 30

#define KEY B 48

#define KEY C 46

#define KEY D 32

#define KEY E 18

#define KEY F 33

#define KEY G 34

#define KEY H 35

#define KEY I 23

#define KEY K 37

#define KEY L 38

#define KEY M 50

#define KEY N 49

#define KEY O 24

#define KEY P 25

#define KEY Q 16

#define KEY R 19

#define KEY S 31

#define KEY T 20

#define KEY U 22

#define KEY V 47

#define KEY W 17

#define KEY X 45

#define KEY Y 21

#define KEY Z 44

#define ALT F2 105

#define ALT F6 109

#define CTRL 4

#define SHIFT 1

#define ESC 1

#define BACKSPACE 14

#define LEN sizeof(struct student)

/*菜单选项。下拉标志*/

int menu x yes=1;

int menu y yes=0;

int menu x=1;

int menu x old=0;

int menu y1=1, menu y3=1;

/*保存文件名*/

char filename[43]="NONAME.dat";

/*开辟保存数据的空间*/

void *buf=0;

int left,top,right,bottom;

/*开辟保存数据的空间*/

struct student

{ long num;

char name[15];

float h maths;

float english;

float c;

float sum;

int s sum;

struct student*next;

};

struct student*head=0,*p1,*p2;

int record n;

char key buf[50];

long student number=0;

char student name[13];

float student score=0;

/*读键扫描码*/

char get key(void)

{ AH=0; int (0X16); return( AH); }

/*显示字符*/

void show char(char z)

{ AL=z; AH=0x0e; int (0x10);}

/*测试是否有键输入*/

int key pressed(void)

{ AH=0x0b; int (0x21); if( AL==0) return(0); else return(1);}

/*退出程序*/

voidquit(void)

{ void free data(void);void restore menu(void); free data();

restore menu(); window(1,1,80,25,0x0f);

cur show(); gotoxy(1,1); exit(1);

}

/*回到dos提示符*/

void os shell(void)

{void mainmenu show(void);

window(1,1,80,25,0x0f);

cur show(); gotoxy(1,1); system("");

mainmenu show();

}

/*主窗口文字*/

void main menu 1(void)

{ int i,j; char*p;

char*mainmenu word[]={"File ","Save ","Options ","About me"};

if(menu x!=menu x old||!menu y yes)

{p=mainmenu word[0];

putstr(4,1,0x70,p,35);

for(i=0;i35;i++) if(*p++='Z') putchar(i+4,1,*(p-1),0x74);

p=mianmenu word[0];

if(menu x yes)

for(i=0;j=0;i35;i++)

{it('A'=*p*(p+1)=='')break;

putchar(i+4,1,*p,0x0f); }

p++; }

}

}

void main menu 2(void)

{ int i; int len; char *p;

char*mainmenu word[6]={"F1-Help","F2-Save","F5-OS shell","F10-Menu","Message"};

void main box(void); main box();

p=mainmenu word[0]; putstr(2,25,0x70,p,42);

for(i=0;i42;i++) {if(*p=='F'||('0'=*p*p='9'))putchar(i+2,*p,0x74); p++; }

p=mainmenu word[4]; putstr(36,22,0x17,p,9); len=strlen(filename);

putchar(40-len/2-1,2,'',0x17);

for(p=filename,i=0;*p!=0;p++;i++) putchar(40-len/2+i,2,*p,0x17);

putchar(40-len/2+len,2,'',0x17);

}

/*主窗口线框*/

void main box(void)

{ int i;

for(i=1;i=80;I++) {putchar(i,2,205,0x17); putchar(i,22,196,0x17);putchar(i,24,196,0x17);}

for(i=1;i=80;i++) {putchar(1,i,179,0x17); putchar(80,i,179,0x17); }

putchar(1,2,213,0x17); putchar(80,2,184,0x17); putchar(1,22,195,0x17);

putchar(80,22,180,0x17); putchar(1,24,192,0x17); putchar(80,24,217,0x17);

}

/*显示主窗口菜单*/

voidmianmenu show (void)

{ textmode set(); cur hide();

window(1,1,80,25,0x1e);

window(1,1,80,1,0x70);

window(1,25,80,25,0x70);

main menu 10; main menu 20;

}

/*显示下拉菜单*/

void menu show (void)

{ int i;

char*submenu word[][5]={{"New file F4","Open file F3","OS shell F5","Quit Alt-X"},

p"Input F6","Delete F8","Update F9","query F11","Sort F12"}};

switch(menu x)

{case 1:

if(menu x!=menu x old)

{menu x old=menu x; menu window(3,2,18,8); menu box(3,2,18,8,3,0);}

for(i=0;i2;i++)

{putstr(4,3+i,0x70,submenu word[0][i],14);

putchar(5,3+i,*(submenu word[0][i]+1),0x74); }

for(i=3;i5;i++) putstr(4,3+i,0x7-,submenu word[0][i-1],14);

putchar(6,6,*(submenu word[0][2]+2),0x74);

putchar(5,7,*(submenu word[0][3]+1),0x74);

window(4,2+menu y1,17,2+menu y1,0x0f);

if(menu y1=2)

putstr(4,2+menu y1,0x0f,submenu word[0][menu y1-1],14);

else

putstr(4,2+menu y1,0x0f,submenu word[0][menu y1-2],14); break;

case 2:menu x old=menu x; menu window(19,2,44,8);}

for(i=0;i5;i++)

{putstr(20,3+i,0x70,submenu word[1][i],24);

putchar(21,3+i,*(submenu word[1][i]+1,0x74); }

window(20,2+menu y3,43,2+menu y3,0x0f);

putstr(20,2+menu y3,0x0f,submenu word[1][menu y3-1],24); break;

case 4:menu x old=menu x; }

}

/*清空键盘缓冲*/

void clr buf(void){ key buf[1]=0;}

void free data(void)

{ struct student*pa,*pb;

if(head)

{pb=pa=head;

do{ pb=pa; pa=pb-next; free(pb);}while(pa!=0);head=0; }

}

/*姓名处理*/

int string name(void)

{ int i,j;

if(key buf[1]==0) return(0);

for(i=2,j=0;i=key buf[1]+1;i++;j++)

student name[j]='\0'; return(1);}

/*输入数据*/

voidinput(int flag)

{ int i; char*s1="NO. Name H maths English C\\C++ ";

char*s2=" | | | | ";

char*title="INPUT"; menu window(15,10,64,14); window(17,12,62,12,0x17);

putstr(37,10,0x70,title,7); putstr(17,11,0x70,s1,46);

if(head==0)

{ head=p1=p2=(struct student*)malloc(LEN);if(!head)memory error();

p1-next=0;

else{

for(p1=head,record n=0;p1!=0;record n++)

{ p2=p1; p1=p2-next; }

p1=(struct student*)malloc(LEN);

if(!p1)memory error();

p2-next=p1; }

while(1)

{record n++; putstr(17,12,0x07,s2,46);

if(flag==1)

{gotoxy(52,13); printf("Record%d",record n); }

do{ window(17,12,26,12,0x07);

if(!getstring(17,12,10))goto out ;

}while(!getstring number());

p1-num=student number;

do{ if(!getstring(28,12,12)) goto out;

}while(!string name());

strcpy(pi-name,student name);

for(i=1;i=3;i++)

{ do{ window(41+(i-1)*8,12,0x07);

if(!getstring(41+(i-1)*8,12,5)) gotoout;

}while(!string score());

if(i==1)p1-h maths=student score;

if(i==2)pi-english=student score;

if(i==3)p1-c=student score; }

p1-sum=0.0; p1-s num=0;

if(flag==2){record n--;goto out;}

p2=p1;

p1=(struct student*)malloc(LEN);

if(!p1)memory error();

p1-next=0; p2-next=p1; }

out: cur hide(); window(15,10,65,15,0x1e);

if(flag==1) {if(head==p1)head=0; free(p1); p2-next=0; info(1); record n--; }

menu x yes=1; main menu 1();

}

/*查看是否有该成绩*/

struct student* search(int flag)

{ struct student8pa,*pb; if(head==0)return(0); pb=pa=head;

if(flag==1)

{if(head-num==student number) return(head-1);

do{ if(pa-num==student number) return(pb);

pb=pa; pa=pb-next;} while(pa!=0); }

return (0);

}

/*查询,删除,修改对话框*/

struct student*msg box(int which)

{ int flag; int key; char*p="-A B-"; menu window(22,10,60,14); gotoxy(29,11);

printf("Number OR Name"); window(24,12,58,12,0x07); gotoxy(24,12);

printf(" | "); gotoxy(37,10);

switch(which)

{ case 1:printf("Delete");break;

case 2:printf("Update");break;

case 3:printf("Query");break; }

do{ while(!key pressed())

now time();

key=get key(); if(key==KEY A) {flag=1;break;}

if(key==KEY B) {flag=2;break;} printf("\07");

}while(1);

putstr(37,13,0x64,p,7);

if(flag==1)

{ do{

gotoxy(24,12); printf(" | "):

if(!getstring(24,12,10)) goto out;

}while(!string number());

window(22,10,61,15,0x1e); return(search(1)); }

else

{do{ gotoxy(24,12); printf(" | ");

if(!getstring(41,12,12)) goto out;

}while(!string name());

window(22,10,61,15,0x1e); return(0);}

/*删除记录*/

void delete(void)

{ struct student*pa,*pb; pb=msg box(1); if(pb==0)info(3);

else

{ if(pb==(head-1))

{ pb=head; if(pb-next==0) head=0;

else head=pb-next; }

else

{ if(pb-next-next==0) {pb-next=pa; } }

record n--; info(2); }}

/*删除记录*/

void update(void)

{int i; struct student*p; i=record n; p=msg box(2;

if(p==0)info(3);

else

{ input(2);

if(i==record n)

{if(p==(head-1)){

head-num=p1-num; strcpy(head-name,p1-name);

head-h maths=p1-h maths; head-english=p1-english;

head-c=p1-c; free(p1); p2-next=0; }

else { p-next-num=p1-num; strcpy(p-next-name,p1-name);

p-next-h maths=p1-h maths; p-next-english=p1-english;

p-next-c=p1-c; free(p1); p2-next=0; }

info(4); }

else {record n--;p2-next=0;free(p1);info(5);} }}

/*查询成绩*/

void query(void)

{ struct student*p,*pa,*pb; int key ,flag,i,j;

char*str="NO. Name H matns English C\\C++ Sum S NO.";

char*sm="NO. Name h maths English C\\C++ (who fails)";

menu window(26,10,56,12); gotoxy(28,11); printf("Find Fail");

putchar(33,11,'A',0xe4); putchar(49,11,'B',0xe4);

do{if(!key pressed()) now time();

key=get key();

if(key==KEY A){flag=1;break;}

if(key==KEY B){flag=2;break;}

printf("\07"); }while(1);

window(26,10,57,13,0x1e); if(flag==1)

{ p=msg box(3); if(p==0) info(3);

else{window(6,5,76,21,0x0e); window(5,4,75,20,0x5e); window(6,5,74,19,0x0e);

putstr(13,4,0x5a,str,58); gotoxy(6,6);

if(p!=(head-1)){pa=p-next;p=pa;}

else p=head;

printf("%101d%13s%8.1f%9.1f%9.1f%9.1f%6d\n",\

p-num,p-name,p-h maths,p-english,p-c,p-sum,p-s sum);

}}

if(flag==2)

{ window(6,5,76,21,0x0e);window(5,4,75,20,0x5e); window(6,5,74,19,0x0e);

putchar(13,4,0x5a,sm,59); if(head)

{ pa=head; j=0;

do{ j++; i=0; window(6,5,74,19,0x0e); gotoxy(65,20);

printf("Page%d",j);

do

{ if(pa-c60||pa-h maths60||pa-english60)

{gotoxy(6,6+i); i++;

printf("%101d%13s%8.1f%9.1f%9.1f%9.1f%6d\n",\

p-num,p-name,p-h maths,p-english,p-c,p-sum,p-s sum);}

pb=pa; pa=pb-next; }while(i!=13pa!=0);

while(!key pressed()) now time();

get key(); }while(pa!=0);

goto out;}}

while(!key pressed())

now time();get key();

out:window(5,4,76,21,0x1e);}

/*成绩排名*/

void sort(void)

{ int i,j,n,flag; struct student*pa=0,*pb=0;

struct student*p[500],*pmin;

char*str="NO. Name H maths English C\\C++ Sum S NO.";

window(6,5,76,21,0x0e); window(5,4,75,20,0x5e); window(6,5,74,19,0x0e);

putstr(13,4,0x5a,str,58); window(60,20,73,20,0x5b);

if(head!=0)

{ i=0; pb=pa=head;

do

{p[i]=pa; i++; pa-sum=pa-h maths+pa-english+pa-c;

pb=pa; pa=pb-next; }while(pa!=0);

for(n=record n-1,i=0;in;i++)

{ flag=0;

for(j=0;jn-i;j++)

if(p[j]-sump[j+1]-sum)

{ pmin=p[j]; p[j]=p[j+1]; p[j+1]=pmin; flag=1; }

if(flag==0)break; }

head=pb=pa=p[0]; head-s sum=1;

if(record n1)

for(i=1;irecord n;i++) { pa-s sum=i; pb=pa; pa=pb-next=p[i];}

p2=p1=p[record n-1]; p1-s sum=record n;

p1-next=0; pb=pa=head;

j=0;

do{

j++;i=0; window(6,5,74,19,0x0e); gotoxy(65,20); printf("Page%d",j);

do

{gotoxy(6,6+i); i++;

printf("%101d%13s%8.1f%9.1f%9.1f%9.1f%6d\n",\

p-num,p-name,p-h maths,p-english,p-c,p-sum,p-s sum);}

pb=pa; pa=pb-next; }while(i!=13pa!=0);

while(!key pressed()) now time();

get key(); }while(pa!=0);

goto out;}

while(!key pressed())

now time();get key();

out:window(5,4,76,21,0x1e);}

/*输入文件名*/

int input filename(int m)

{ char*p; int fp; menu window(19,10,64,12);

window(20,11,63,11,0x07);

gotoxy(35,10); printf("File name");

if(!getstring(20,11,40)) goto no;

if(key buf[1]==0) goto no;

p=key buf+2; key buf[key buf[1]+2]='\0';

if(fp=fopen(p,"rb+"))==0)

{if(m==2) goto no; if(fp=fopen(p,"wb+"))==0 goto no; }

fclose(fp); strcpy(filename,p);

yes: window(19,10,65,13,0x1e);

return(1);

no: window(19,10,65,13,0x1e);

return(0);

}

/*新建文件*/

void new file(void)

{ int fp;

if(input filename(1)==0) info(9;

else

{main menu 2(); free data(); fp=fopen(filename,"wb+"); fclose(fp); info(10); }

}

/*打开文件*/

void open file(void)

{ struct student*pa,*pb; int fp;

if(input filename(2)==0)info(6);

else

{free data(); head=pb=pa=(struct student*)malloc(LEN); fp=fopen(filename,"rb+";

fread(pa-num,LEN,1,fp);}

info(8); fclose(fp); input(1); }}

/*保存文件*/

void save fiel(void)

{ struct student8pa,*pb; int fp;

if((fp=fopen(filename,"rb+"))==0) fp=fopen(filename,"wb+");

pb=pa=head;

if(fp!=0head!=0)

{do{fwrite(pa-num,LEN,1,fp); pb=pa; pa=pb-next;}while(pa!=0);

fclose(fp); }

info(7);

}

void about me(void)

{ int i; char*title="About Me"; char*str[]={" I'M A BIG.BIG WORLD. "};

menu window(20,5,58,18); putstr(35,5,0x70,title,10);

for(i=0;i12;i++)putstr(25,6+i,0x75,str[i],29);

while(!key pressed()) now time();

get key(); window(20,5,59,19,0x1e);

}

system("PAUSE");

return EXIT_SUCCESS;

}

求C语言学生档案管理界面的源代码

# includeiostream.h

# includestring.h

# includestdio.h

# includestdlib.h

# includefstream.h

//*****定义一个学生原子的的数据结构*****//

struct stuatom

{

char *name;

int id;

char sex;

float math, eng, comp, totll, aver;

void show();

void setup();

};

//*********定义一系列对学生的操作**********//

class student

{

private:

stuatom ob[100];

int stulen;

public:

student();

void input();

void order();

void save();

void Query();

void read();

void add();

void del();

};

//********对学生数据的初始化(类的构造函数)**********//

student::student()

{

//用for循环对全部数组中的数据初始化

for(int i=0;i100;i++)

{

ob[i].math=ob[i].eng=ob[i].comp =ob[i].totll =ob[i].aver =0;

ob[i].id =0;

ob[i].sex =' ';

ob[i].name =NULL;

}

this-stulen =0;

}

//********输入学生的数据,并判断是否在规定数据域内*******//

void stuatom::setup()

{

char n[20]; char s;

int b;

//如果输入学好在数据域内,跳出循环并且赋值。

//如果不再数据域内,一直循环到输入数据符合数据域为止

do {

cout" 学号: ";

cinb;

if(b1020||b1001)

cout"Bad data input!!"endlendl;

}while (b1001||b1020);

id=b;

//如果输入学好在数据域内,跳出循环并且赋值。

//如果不再数据域内,一直循环到输入数据符合数据域为止

do{

name=new char[strlen(n)+1];

cout" 姓名: ";

cinn;

if( strlen(n)6 || strlen(n)4 )

cout"Bad data input!!"endlendl;

}while ( strlen(n)6 strlen(n)4 );

strcpy(name,n);

cout" 性别(m/f):" ;

cins;

//如果输入学好在数据域内,跳出循环并且赋值。

//如果不再数据域内,一直循环到输入数据符合数据域为止

while (s!='m' s!='f')

{

cout"Bad data input!!"endlendl;

cout" 性别(m/f):";

cins;

}

sex=s;

float m, e, co;

cout" 数学: ";

cinm;

//如果输入学好在数据域内,跳出循环并且赋值。

//如果不再数据域内,一直循环到输入数据符合数据域为止

while (m0 || m100)

{

cout"Bad data input!!"endlendl;

cout" 数学: ";

cinm;

}

math=m;

cout" 英语: ";

cine;

//如果输入学好在数据域内,跳出循环并且赋值。

//如果不再数据域内,一直循环到输入数据符合数据域为止

while (e0 || e100)

{

cout"Bad data input!!"endlendl;

cout" 英语: ";

cine;

}

eng=e;

cout" 计算机: ";

cinco;

//如果输入学好在数据域内,跳出循环并且赋值。

//如果不再数据域内,一直循环到输入数据符合数据域为止

while (co0 || co100)

{

cout"Bad data input!!"endlendl;

cout" 计算机: ";

cinco;

}

comp=co;

totll=math+eng+comp;

aver=(math+eng+comp)/3;

}

//*******按照规定格式把该学生的数据显示在屏幕上******//

void stuatom::show()

{

cout.setf(ios::left);

cout.width(6);

cout""id" ";

cout.width(8);

coutname;

cout.width(10);

coutsex;

cout.width(9);

coutmath;

cout.width(9);

couteng;

cout.width(11);

coutcomp;

cout.width(10);

couttotllaverendl;

}

//**************输入学生的数据***********************//

void student::input()

{

int n;

coutendl"输入将要录入的学生数目: ";

cinn;

int j;

//通过循环输入要求输入学生个数的学生的数据。

for(j=0; jn; j++)

{

cout" 输入学生信息 "jendl;

ob[j].setup();

}

this-stulen=n; //学生个数赋值

//学生数据显示格式

system("cls");

coutendl"----------------------------- 学生信息表 ------------------------------------"endl;

coutendl" 学号 姓名 性别 数学 英语 计算机 总分 平均分"endl;

//通过循环输出所有学生数据。

for(j=0; jn; j++)

{

ob[j].show();

}

coutendl;

cout" 是否保存? (Y/N): ";

char Y;

cinY;

system("cls");

}

//**************按照一定格式显示所要查询学生的信息。**************//

void student::Query()

{

int x , i;

coutendl" 输入要查询学生的学号: ";

cinx;

coutendl" 学号 姓名 性别 数学 英语 计算机 总分 平均分"endl;

for(i=0;i=this-stulen ;i++)

{ if (x==ob[i].id)

{

cout.setf(ios::left);

cout.width(6);

cout""ob[i].id" ";

cout.width(8);

coutob[i].name;

cout.width(10);

coutob[i].sex;

cout.width(9);

coutob[i].math;

cout.width(9);

coutob[i].eng;

cout.width(11);

coutob[i].comp;

cout.width(10);

coutob[i].totllob[i].averendl;

}

}

getchar();

}

//*******************保存学生数据**************************//

void student::save()

{

int i;

ofstream outfile;

outfile.open("list.txt",ios::trunc);

if(!outfile)

{

cout"Cannot open output file!\n,";

}

//通过循环把所有的学生数据保存在list.txt里边。

for(i=0; ithis-stulen; i++)

{

outfileob[i].id" "ob[i].name" "ob[i].sex" "

ob[i].math" "ob[i].eng" "ob[i].comp" "ob[i].totll" "ob[i].averendl;

}

outfile.close();

}

//*************显示所有学生数据*********************//

void student::read()

{

int i;

system("cls");

coutendl"----------------------------- 学生信息表 ------------------------------------"endl;

coutendl" 学号 姓名 性别 数学 英语 计算机 总分 平均分"endl;

for(i=0; ithis-stulen; i++)

{

ob[i].show();

}

getchar();

}

//*******************一个学生的数据****************//

void student::add()

{

int i, d=this-stulen ;

cout"输入要添加学生的信息:"endl;

ob[d].setup();

coutendl"----------------------------- 学生信息表 ------------------------------------"endl;

coutendl" 学号 姓名 性别 数学 英语 计算机 总分 平均分"endl;

for(i=0; i=d; i++)

{

ob[i].show();

}

ofstream fout("list.txt",ios::app);

if(!fout)

{

cout"Cannot open output file!\n,";

}

//把添加的学生数据添加到list.txt里边去。

foutob[d].id" "ob[d].name" "ob[d].sex" "

ob[d].math" "ob[d].eng" "ob[d].comp" "ob[d].totll" "ob[d].averendl;

fout.close();

getchar();

}

//*********************删除指定名字学生的数据*******************//

void student::del()

{

int i,p; char x[8];

cout" 输入要删除学生名字:"endl;

cinx;

//通过for循环查找要删除学生的姓名

for(i=0; istulen; i++)

{

if(strcmp(ob[i].name,x)==0)

{

p=i;

coutendl"学号 姓名 性别 数学 英语 计算机 总成绩 平均成绩"endl;

coutob[i].id" "ob[i].name" "ob[i].sex" "ob[i].math" "ob[i].eng" "ob[i].comp" "ob[i].totll" "ob[i].averendl;

break;

}

else

continue;

}

coutendl"----------------------------- 学生信息表 ------------------------------------"endl;

coutendl" 学号 姓名 性别 数学 英语 计算机 总分 平均分"endl;

//删除了之后,应该把后面的数据往前移,把要删除的数据覆盖,并且学生长度减1

stulen--;

for(i;istulen;i++)

{

ob[i]=ob[i+1];

}

this-read ();

cout" 删除成功!"endl;

getchar();

}

//***********把学生成绩排序******************//

void student::order()

{

int k,j;

float t; char n[20];

//排序算法。

for(j = 0; j=(2-1); j++)

{

for(k=1; k=(2-j); k++)

{

if(ob[k].totll ob[k + 1].totll)

{

t = ob[k].totll;

ob[k].totll = ob[k+1].totll;

ob[k+1].totll = t;

strcpy(n, ob[k].name);

strcpy(ob[k].name, ob[k+1].name);

strcpy(ob[k+1].name, n);

}

cout" 成绩排名:"endl;

cout" 姓名 总成绩 名次"endl;

for(k=0; k=stulen; k++)

{

cout" ";

cout.setf(ios::left);

cout.width(9);

coutob[k].name;

cout.width(9);

coutob[k].totllkendl;

}

getchar();

}

}

}

//********************选择菜单。*****************//

void menu()

{

cout"\n\n";

cout"------------------ 学生成绩系统 -----------------"endlendl;

cout"\t\t1.录入与保存学生信息.\n";

cout"\t\t2.读取学生信息.\n";

cout"\t\t3.删除学生信息.\n";

cout"\t\t4.追加学生信息.\n";

cout"\t\t5.查询学生信息.\n";

cout"\t\t6.显示成绩名次.\n";

cout"\t\t7.退出系统......\n\n\n";

cout"\t\t请选择功能项: ";

}

//---------------------------------------------------------------------------------------

void main()

{

student a;

while(1)

{

int SEL;

system("cls");

menu();

cinSEL;

switch(SEL)

{

case 1:

system("cls"); a.input();a.save();break;

case 2:

system("cls"); a.read(); break;

case 3:

system("cls"); a.del(); break;

case 4:

system("cls"); a.add();break;

case 5:

system("cls"); a.Query();break;

case 6:

system("cls"); a.order();break;

case 7:

coutendl" 按任意键退出.... "endl;

getchar();

exit(0);

default:

cout"Bad input!!\n";

break;

}

}

} 我比较忙,没有亲自帮你写,你自己改改吧,框架出来了。

急急!!用数据结构和C语言(别使用C++) 编写图书信息管理系统代码

/*输入图书信息*/

struct library *input_message(void)/*指向输入图书信息*/

{struct library *p1,*p2,*head;/*包含三个指针*/

char ch;/*字符*/ head=NULL;/*头指针为空*/

head=p2=p1=(struct library*)malloc(N);/*指针自由分配的空间大小为N*/

do{

p1=(struct library *)malloc(N);/*当p1所占的大小为N时*/

clrscr();/*清屏*/

printf("\n\n\t**Input book message**\n");/*输出图书信息*/

printf("\t serial_number:");/*输出序列号*/

scanf("%ld",p1-b_num);/*输入书的名字*/

printf("\t book_name:");/*输出书的名字*/

scanf("%s",p1-b_name);/*输入书的名字*/

printf("\t press_name:");/*输出出版社*/

scanf("%s",p1-p_name);/*输入出版社*/

printf("\tpress_time(yy-mm):");/*输出出版日期*/

scanf("%d%d",p1-p_time.year,p1-p_time.month);/*输入出版日期*/ printf("\t total_number:");/*输出图书总数*/

scanf("%ld",p1-t_num);/*输入图书总数*/

printf("\t left_number:");/*输出剩余图书数*/

scanf("%ld",p1-l_num);/*输入剩余图书数*/

printf("\t book_kind:");/*输出图书种类*/

scanf("%s",p1-b_kind);/*输入图书种类*/

p2-next=p1;/*将p2指针指向P2*/p2=p1;

printf("\t\tContinue? (Y/N):");/*输出信息“是否继续(是/不是)?”*/

ch=getch();/*输入字符*/

}while(ch=='Y'||ch=='y');/*当输入‘Y’或者‘y’的时候*/

p2-next=NULL;/*最后一个结点的后继指针为空*/

p1=head;/*p1等于头指针*/

head=p1-next;/*头指针等于p1所指向的下一个*/

free(p1);/*释放出p1的空间*/

printf("\n\tInput over!");/*打印输入结束*/

ch=getchar();/*输入字符*/

return head;/*返回首部*/}/*储存图书信息*/

save_message(struct library *p)

{FILE *fp;/*定义指向文件的指针*/

if((fp=fopen("library.txt","wt"))==NULL)/*为输出打开一个二进制文件夹,如果没有则建立*/

{ printf("\nSorry! Open the document to be wrong!");/*输出对不起,打开文件失败*/ return;/*返回*/}

while(p!=NULL)/*如P不为空*/

{ fprintf(fp,K);/*输出图书的序列号,书名,出版社,出版日期,图书总量,剩余图数量,书的种类等信息*/

p=p-next;/*p等于p所指向的next*/ }

fclose(fp);/*关闭文件*/

return;/*返回*/}

数据结构学生管理系统源代码的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于学生管理系统架构、数据结构学生管理系统源代码的信息别忘了在本站进行查找喔。

版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;

本文地址:http://ahzz.com.cn/post/30431.html


取消回复欢迎 发表评论:

分享到

温馨提示

下载成功了么?或者链接失效了?

联系我们反馈

立即下载