c语言学生信息管理系统Word文档下载推荐.docx

上传人:b****6 文档编号:17070160 上传时间:2022-11-28 格式:DOCX 页数:32 大小:20.30KB
下载 相关 举报
c语言学生信息管理系统Word文档下载推荐.docx_第1页
第1页 / 共32页
c语言学生信息管理系统Word文档下载推荐.docx_第2页
第2页 / 共32页
c语言学生信息管理系统Word文档下载推荐.docx_第3页
第3页 / 共32页
c语言学生信息管理系统Word文档下载推荐.docx_第4页
第4页 / 共32页
c语言学生信息管理系统Word文档下载推荐.docx_第5页
第5页 / 共32页
点击查看更多>>
下载资源
资源描述

c语言学生信息管理系统Word文档下载推荐.docx

《c语言学生信息管理系统Word文档下载推荐.docx》由会员分享,可在线阅读,更多相关《c语言学生信息管理系统Word文档下载推荐.docx(32页珍藏版)》请在冰豆网上搜索。

c语言学生信息管理系统Word文档下载推荐.docx

voidstatitics();

/***********主函数************/

voidmain(){

while(test){

/*ystem("

cls"

);

GotoXY(30,10);

printf("

同学通讯录管理系统(顺序结构查询)\n"

GotoXY(29,11);

===================================\n"

GotoXY(29,13);

1.输入2.查询3.修改\n"

GotoXY(29,15);

4.排序5.统计6.退出\n"

GotoXY(29,17);

GotoXY(29,19);

printf("

请选择:

"

//getch();

scanf("

%d"

&

n);

*/

mainColumName();

if(n<

1||n>

6){

GotoXY(40,19);

printf("

输入无此选项"

test=!

test;

}

switch(n){

case1:

{

//system("

DispColumName();

Input();

}break;

case2:

{

QueryColumName();

Query();

case3:

Modification();

case4:

SortAry();

case5:

statitics();

case6:

{system("

test=false;

}break;

}

}

/***********坐标定位************/

voidGotoXY(intx,inty){

COORDc;

c.X=x-1;

c.Y=y-1;

SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),c);

/***********输入显示模块*************/

voidDispColumName(){

system("

请输入各项信息\n"

GotoXY(25,11);

========================\n"

GotoXY(2,13);

姓名:

GotoXY(20,13);

性别:

GotoXY(33,13);

手机号:

GotoXY(55,13);

年龄:

GotoXY(65,13);

身高(m):

GotoXY(15,15);

是否继续输入(Y/*):

/************输入显示************/

voidInput(){

inti=0;

boola=true;

//intnum;

fp=fopen("

stu.dat"

"

a"

if(fp==NULL)

{

Thefile\"

stu.dat\"

isopenedfiled"

exit

(1);

intcount=0;

while(a){

ScanfInfo(stuAry);

GotoXY(35,15);

//scanf("

%s"

ch);

fflush(stdin);

Ary[count]=stuAry[i];

fwrite(&

stuAry[i],sizeof(structstuType),1,fp);

count++;

ch=getchar();

if(ch=='

Y'

||ch=='

y'

//fwrite(&

//Ary[count]=stuAry[i];

//count++;

//fclose(fp);

ClearInfo();

}

else

{a=false;

//mainColumName();

count=count-1;

fclose(fp);

/***********查询模块方式**********/

voidQuery()

intm;

GotoXY(11,9);

scanf("

m);

fflush(stdin);

switch(m)

QueryDispColumName();

QueryDispColumName1();

QueryName();

QueryName1();

QueryList();

case0:

/***********修改模块方式***********/

voidModification()

intm=0;

inti=0;

intcount=0;

intb=0;

charch,search[9];

GotoXY(30,6);

修改信息"

GotoXY(10,7);

================================================"

GotoXY(10,9);

GotoXY(13,8);

请输入要修改人姓名:

while(a)

GotoXY(33,8);

scanf("

search);

fp=fopen("

"

r"

if(fp==NULL)

printf("

isopenedfiled!

exit

(1);

while(!

feof(fp))

fread(&

Ary[count],sizeof(structstuType),1,fp);

count++;

fclose(fp);

//while(a)

//{

//rewind(fp);

//while(!

char*ch1=Ary[i].name,*ch2=search;

for(i=0;

i<

count;

i++)

//fread(&

Ary[m],sizeof(structstuType),1,fp);

//char*ch1=Ary[i].name,*ch2=search;

if(strcmp(Ary[i].name,search)==0)

{

GotoXY(2,13);

GotoXY(20,13);

GotoXY(33,13);

GotoXY(55,13);

GotoXY(65,13);

GotoXY(8,13);

stuAry[i].name);

GotoXY(26,13);

stuAry[i].gender);

fflush(stdin);

GotoXY(42,13);

stuAry[i].phone);

while(strlen(stuAry[i].phone)!

=11)

{

DispErrorInfo();

GotoXY(25,19);

手机号码输入错误,应为11为数字!

GotoXY(42,13);

"

stuAry[i].phone);

}

ClDispInfo();

GotoXY(61,13);

stuAry[i].age);

while(stuAry[i].age<

0||stuAry[i].age>

120)

GotoXY(25,19);

年龄输入应在0-120之内"

GotoXY(61,13);

scanf("

GotoXY(75,13);

%f"

stuAry[i].hight);

while(stuAry[i].hight<

0||stuAry[i].hight>

3)

GotoXY(25,19);

身高应在0-3米之内"

GotoXY(75,13);

Ary[i]=stuAry[i];

b++;

//fwrite(&

Ary[i],sizeof(structstuType),1,fp);

//fclose(fp);

//fclose(fp);

count=count-1;

w"

fwrite(&

Ary[i],sizeof(structstuType),1,fp);

if(b<

=0)

GotoXY(37,8);

没有此项"

GotoXY(15,20);

是否继续修改(Y/*):

GotoXY(35,20);

ch=getch();

GotoXY(8,13);

GotoXY(33,8);

GotoXY(26,13);

else

a=!

a;

/************排序***********/

voidSortAry()

inta,b,c;

GotoXY(25,3);

数据年龄升序显示"

GotoXY(5,4);

====================================================================="

GotoXY(6,5);

姓名性别手机号年龄身高(m)"

GotoXY(5,20);

fp=fopen("

fread(&

i++;

i=i-1;

for(a=0;

a<

i-1;

a++)

for(b=a+1;

b<

i;

b++)

if(Ary[a].age>

=Ary[b].age)

{

c=Ary[a].age;

Ary[a].age=Ary[b].age;

Ary[b].age=c;

GotoXY(5,7+a);

Ary[a].name);

GotoXY(18,7+a);

Ary[a].gender);

GotoXY(29,7+a);

Ary[a].phone);

GotoXY(47,7+a);

Ary[a].age);

GotoXY(55,7+a);

%1.2f"

Ary[a].hight);

GotoXY(10,21);

信息显示完毕,按Esc键返回上一层...."

if(getche()==27)

test=!

/***********统计模块***********/

voidstatitics()

inta;

floatage,hight,sum2=0,sum1=0;

GotoXY(15,5);

信息统计"

GotoXY(5,6);

==============================="

if(fp==NULL)

count++;

GotoXY(5,7);

班级总人数:

count);

sum1+=Ary[a].age;

sum2+=Ary[a].hight;

age=float(sum1)/count;

hight=sum2/count;

GotoXY(5,8);

班级平均年龄是:

age);

GotoXY(5,9);

班级平均身高(m):

%1.2f"

hight);

GotoXY(5,11);

信息显示完毕,按Esc键返回上一层..."

/************输入模块显示信息****************/

voidScanfInfo(stuTypestu[]){

GotoXY(8,13);

stu[i].name);

stu[i].gender);

GotoXY(42,13);

stu[i].phone);

while(strlen(stu[i].phone)!

DispErrorInfo();

GotoXY(42,13);

stu[i].phone);

ClDispInfo();

GotoXY(61,13);

stu[i].age);

while(stu[i].age<

0||stu[i].age>

GotoXY(61,13);

GotoXY(75,13);

stu[i].hight);

while(stu[i].hight<

0||stu[i].hight>

//GotoXY(35,15);

//scanf("

//}

/**************清除显示信息***************/

voidClearInfo()

GotoXY(8,13);

GotoXY(35,15);

/*********************//*

voidClearInfo1()

GotoXY(40,13)

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 高中教育 > 英语

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1