c语言学生信息管理系统 ,建立学生信息包括姓名学号,年龄,电话号码,生日,籍贯

作者&投稿:晨悦 (若有异议请与网页底部的电邮联系)
跪求,急啊!!!急!!!!C语言学生管理系统~

大一的时候C的作业,代码不一定很好,你看着改下就行了

原题:
请定义一个描述学生基本信息的结构,包括姓名,学号,籍贯,身份证号,年龄,家庭住址,性别,联系方式等。并定义一个结构体数组。编程:
a)
编写函数
input() , 输入基本信息(3~5条记录);
b)
编写函数
print(),输出全体记录信息;
c)
编写函数
search(), 检索一个指定的学生信息并返回, 由主函数打印到屏幕上;
d) 说明,访问结构的时候,什么时候应该用运算符“.”,什么时候应该用运算符“->”。

说明:访问时用结构体的话用成员运算符,用指针则用指向运算符。

#include
#include
#include
struct student
{
char name [10];
char number[10];
char hometown[10];
char ID[20];
int age;
char address[10];
char gender[8];
char tele[10];
};

void input(struct student * p)
{
int i;
for(i=0;i<5;i++)
{
printf("请输入姓名(退出输入quit):");
gets((*(p+i)).name);fflush(stdin);
if(!strcmp((*(p+i)).name,"quit"))break;
printf("请输入学号:");
gets((*(p+i)).number);fflush(stdin);
printf("请输入籍贯:");
gets((*(p+i)).hometown);fflush(stdin);
printf("请输入身份证号:");
gets((*(p+i)).ID);fflush(stdin);
printf("请输入年龄:");
scanf("%d",&((*(p+i)).age));fflush(stdin);
printf("请输入住址:");
gets((*(p+i)).address);fflush(stdin);
printf("请输入性别:");
gets((*(p+i)).gender);fflush(stdin);
printf("请输入联系方式:");
gets((*(p+i)).tele);fflush(stdin);
}
}

void print(struct student * p)
{
int i=0;
for(;(i<5)&&(strcmp((*(p+i)).name,"quit"));i++)
printf
("
name:%-10s number:%-10s
hometown:%-10s ID:%-20s
age:%d address:%-10s
gender:%-10s tele:%-10s
",(*(p+i)).name,
(*(p+i)).number,(*(p+i)).hometown,(*(p+i)).ID,(*(p+i)).age,
(*(p+i)).address,(*(p+i)).gender,(*(p+i)).tele);
}

int search(struct student * p,char * num)
{
int i;
for(i=0;i<=5;i++)
if(strcmp(num,(p+i)->number)==0)break;
return (i);
}

void main()
{
int i;
struct student group[5];
char num[10];
input(group);
printf("
");
print(group);
printf("

请输入要查找的学号:");
gets(num);
i=search(group,num);
if(i==5)
printf("查无此人");
else
printf("
name:%-10s number:%-10s
hometown:%-10s ID:%-20s
age:%d address:%-10s
gender:%-10s tele:%-10s


",(*(group+i)).name,
(*(group+i)).number,(*(group+i)).hometown,(*(group+i)).ID,(*(group+i)).age,
(*(group+i)).address,(*(group+i)).gender,(*(group+i)).tele);
}

这个学期一开学两个星期没有上课,就搞了一个下面的小软件:

学生籍贯信息管理系统

可以实现功能:1.学生学号、姓名、籍贯等信息的录入

2.学生信息保存到磁盘,并能够从磁盘读取、显示

3.学生信息查询:
1)用学号查询并输出所查到信息

2)用姓名查询并输出查到的所有学生信息

3)用籍贯查询并输出查到的所有学生信息

4.学生信息处理:包括修改、增加、删除学生信息


附录: 源程序代码(用C写的)

#include
#include
#define LEN sizeof(struct student)
#define NULL 0

struct student
{long num;
char name[20];
char jg[20];
struct student *next;
};

int n=0;

void save(struct student *head)
{ FILE *fp;
char filename[20];
struct student *p1;
printf("Please input the filename
");
scanf("%s",filename);
if((fp=fopen(filename,"w"))==NULL)
{printf("can't open file
");
return;
}
for(p1=head;p1!=NULL;p1=p1->next)
{fprintf(fp,"%ld",p1->num);
fputc('',fp);
fprintf(fp,"%s",p1->name);
fputc('',fp);
fputc('',fp);
fprintf(fp,"%s",p1->jg);
fputc('
',fp);
}
free(p1);
fclose(fp);
}

void print(struct student *head)
{ struct student*p;
printf("
Now,these information is:
");
p=head;
if(head!=NULL)
do
{printf("%ld%s%s
",p->num,p->name,p->jg);
p=p->next;
}while(p!=NULL);
}

struct student *creat()
{ struct student *head,*p1,*p2;
char ch;
p1=p2=(struct student *)malloc(LEN);
printf("
Welcome to student jiguan system!
");
printf("Please input one's num,name and jiguan
");
printf("\"0 0 0\":exit
");
scanf("%ld%s%s",&p1->num,p1->name,p1->jg);
head=NULL;
while(p1->num!=0)
{n=n+1;
if(n==1)head=p1;
else p2->next=p1;
p2=p1;
p1=(struct student *)malloc(LEN);
scanf("%ld%s%s",&p1->num,p1->name,p1->jg);
}
p2->next=NULL;
free(p1);
printf("Save?Y/N
");
scanf("%c",&ch);
scanf("%c",&ch);
if(ch=='y'||ch=='Y') save(head);
print(head);
return(head);
}


void loadf()
{FILE *fp;
int N=n;
char filename[20];
struct student *p1;
p1=(struct student *)malloc(LEN);
printf("Please input the filename
");
scanf("%s",filename);
if((fp=fopen(filename,"r"))==NULL)
{printf("cannot open file
");
return;
}
printf("File has been open:
");
for (;N!=0;N--)
{ fscanf(fp,"%ld%s%s",&p1->num,p1->name,p1->jg);
printf("%ld%s%s
",p1->num,p1->name,p1->jg);
}
free(p1);
fclose(fp);
}

void xsearch(struct student*head)
{long num;
struct student *p1,*p2;
int c=0;
printf("Please input the search number:
");
scanf("%ld",&num);
for(p1=head;p1!=NULL;p1=p1->next)
{ if(num==p1->num)
{c=c+1;
printf("%ld%s%s
",p1->num,p1->name,p1->jg);
}
}
printf("There are %d results!
",c);
}

void nsearch(struct student*head)
{char name[20];
struct student *p1,*p2;
int c=0;
printf("Please input the search name:
");
scanf("%s",name);
for(p1=head;p1!=NULL;p1=p1->next)
{ if(strcmp(name,p1->name)==0)
{c=c+1;
printf("%ld%s%s
",p1->num,p1->name,p1->jg);
}
}
printf("There are %d results!
",c);
}

void jsearch(struct student*head)
{char jg[20];
struct student *p1,*p2;
int c=0;
printf("Please input the search jiguan:
");
scanf("%s",jg);
for(p1=head;p1!=NULL;p1=p1->next)
{ if(strcmp(jg,p1->jg)==0)
{c=c+1;
printf("%ld%s%s
",p1->num,p1->name,p1->jg);
}
}
printf("There are %d results!
",c);
}

void search(struct student*head)
{
int a=4;
for(;a!=0;)
{printf("
Welcome to student juguan system!
");
printf("
search information system
");
printf(" 0:exit
");
printf(" 1:use xuehao search
");
printf(" 2:use name search
");
printf(" 3:use jiguan search
");
printf("Please select:
");
scanf("%d",&a);
clrscr();
switch(a)
{case 0:printf("Thank you for playing!Bye!
"); break;
case 1:xsearch(head);break;
case 2:nsearch(head);break;
case 3:jsearch(head);break;
default:printf("Choose error,choose again!
");break;
}
}
}

struct student *del(struct student *head,struct student *p1)
{ struct student *p2;
char ch;
if(p1==NULL) printf("No result,can't manage!
");
else{if(p1==head) head=p1->next;
else
{ for(p2=head;p2->next!=p1;p2=p2->next);
p2->next=p1->next;}
n=n-1;
printf("Save the change?Y/N
");
scanf("%c",&ch);
scanf("%c",&ch);
if(ch=='y'||ch=='Y') save(head);
}
free(p1);
free(p2);
return(head);
}

void change(struct student *head,struct student *p1)
{ char ch;
if(p1==NULL) printf("No result,can't manage!
");
else{printf("Please input the new information of it.
");
scanf("%ld%s%s",&p1->num,p1->name,p1->jg);
printf("Save the change?Y/N
");
scanf("%c",&ch);
scanf("%c",&ch);
if(ch=='y'||ch=='Y') save(head);
}
}

struct student * add(struct student *head,struct student *p1)
{ int a;
char ch;
struct student *p0,*p2;
p0=p2=(struct student *)malloc(LEN);
if(p1==NULL) printf("No result,can't manage!
");
else{
printf("Please input the new student's information.
");
scanf("%ld%s%s",&p0->num,p0->name,p0->jg);
printf("Where would you like to add?
");
printf(" 1:add before it
");
printf(" 2:add after it
");
scanf("%d",&a);
switch(a)
{ case 1:if(p1==head)
{ p0->next=p1;head=p0;}
else
{ for(p2=head;p2->next!=p1;p2=p2->next);
p0->next=p1;
p2->next=p0;
}
break;
case 2:if(p1->next==NULL)
{ p1->next=p0;
p0->next=NULL;
}
else
{ p2=p1->next;
p0->next=p2;
p1->next=p0;
}
break;
default:printf("Choose error,choose again!
");
break;
}
n=n+1;
printf("Save the change?Y/N
");
scanf("%c",&ch);
scanf("%c",&ch);
if(ch=='Y'||ch=='y') save(head);
}
free(p0);
free(p1);
free(p2);
return(head);
}

struct student* inman(struct student*head)
{ char ch;
int a=4;
long num;
char name[20];
char jg[20];
struct student *p1;
printf("Input it's feature,so you can deal with it.
");
printf(" 0:exit
");
printf(" 1:input it's number
");
printf(" 2:input it's name
");
printf(" 3:input it's jiguan
");
scanf("%d",&a);
clrscr();
switch(a)
{ case 0:p1=NULL;break;
case 1:printf("Please input the search number:
");
scanf("%ld",&num);
for(p1=head;p1!=NULL;p1=p1->next)
{ if(num==p1->num)
{ printf("%ld%s%s
",p1->num,p1->name,p1->jg);
printf("Is this one you want?
");
printf("Y/N
");
scanf("%c",&ch);
scanf("%c",&ch);
if(ch=='Y'||ch=='y')
break;
}
}
break;
case 2:printf("Please input the search name:
");
scanf("%s",name);
for(p1=head;p1!=NULL;p1=p1->next)
{ if(strcmp(name,p1->name)==0)
{ printf("%ld%s%s
",p1->num,p1->name,p1->jg);
printf("Is this one you want?
");
printf("Y/N
");
scanf("%c",&ch);
scanf("%c",&ch);
if(ch=='Y'||ch=='y')
break;
}
}
break;
case 3:printf("Please input the search jiguan:
");
scanf("%s",jg);
for(p1=head;p1!=NULL;p1=p1->next)
{ if(strcmp(jg,p1->jg)==0)
{ printf("%ld%s%s
",p1->num,p1->name,p1->jg);
printf("Is this one you want?
");
printf("Y/N
");
scanf("%c",&ch);
scanf("%c",&ch);
if(ch=='Y'||ch=='y')
break;
}
}
break;
default:printf("Choose error,choose again!
");p1=NULL;break;
}
if(p1==NULL) printf("That's all!
");
return p1;
}

struct student * manage(struct student *head)
{ struct student *p1;
int a=4;
p1=(struct student*)malloc(LEN);
for(;a!=0;)
{ printf("
Welcome to the student jiguan system!
");
printf("
manage information system
");
printf("What are you going to do?
");
printf(" 0:exit
");
printf(" 1:add information
");
printf(" 2:delete information
");
printf(" 3:change information
");
scanf("%d",&a);
clrscr();
switch(a)
{case 0:printf("Thank you for playing!Bye!
");break;
case 1:p1=inman(head);
head=add(head,p1);
print(head);
break;
case 2:p1=inman(head);
head=del(head,p1);
print(head);
break;
case 3:p1=inman(head);
change(head,p1);
print(head);
break;
default:printf("Choose error,choose again!
");break;
}
}
return(head);
}

void main()
{struct student *head;
int a;
for(a=5;a!=0;)
{ printf("
Welcome to Student Jiguan System!
");
printf(" MENU
");
printf(" 0:exit
");
printf(" 1:write
");
printf(" 2:read
");
printf(" 3:search
");
printf(" 4:manage
");
printf(" Please select:
");
scanf("%d",&a);
clrscr();
switch(a)
{ case 0:printf("Thank you for using it!Bye!
");break;
case 1:head=creat();break;
case 2:loadf();break;
case 3:search(head);break;
case 4:head=manage(head);break;
default :printf("Choose error,choose again!");break;
}
}

}

在这个学生基本信息管理系统中,定义了函数void getInfo()、void SaveTxt()、void stuSaveTxt()、void showInfo()、void searchmenu()、void searchnum()、void searchname()、void searchsex()、void searchdormitory()、void countmenu()、void altermenu()、void alterstudent()、void erase()、int huoqu(int i)、进行学生信息的录入、保存、显示学生信息、按学号、姓名、性别、寝室号查询;统计学生信息、修改学生信息、删除学生信息等的实现,另外用函数实现了程序中的清屏和退出。在函数中,多次运用switch(),do while()函数,使程序简单顺利的进行。
当然,通过menu()等的菜单函数,来实现功能菜单显示在运行窗口以提示用户如何进行操作。
另外,主函数main()中,不再是全部在一个函数中实现,而是通过对函数的调用,让函数的功能进行实现。
另外,在函数中也用了大量的清屏和退出函数,使整个管理系统更为合理和完善

  单纯只用多个数组管理学生成绩信息,不使用结构体,该程序最主要的难点是依据学号或总成绩对学生信息进行排序,借助了临时数组来标记排好序的下标。


求:小型学生信息管理系统(用c语言编程)
求:小型学生信息管理系统(用c语言编程) 具体要求为:1.建立学生信息,每个学生的信息应包括:学号、姓名、性别、班级、至少3门课程的成绩;2.数据输入:输入学生的各项信息;3.数据修改:根据输入学生的学号可以选择修改该学... 具体要求为:1. 建立学生信息,每个学生的信息应包括:学号、姓名、性别、班级、至少3门...

c语言课程设计 学生信息管理系统模拟
void output(); \/\/输出学生的成绩 void error(); \/\/错误提示 void insert(); \/\/插入数据 void print(int i); \/\/输出具体信息 void main(){ menu();} void menu(){ int select; \/\/选择标志(1--7间)system("cls");printf("\\t\\t\\t学员成绩管理系统\\n");printf("***\\n");p...

关于C语言课题设计(学生信息管理系统)
else printf("没有该学生信息!\\n");} } void listadd(student *head){student *p,*s;int flag=1;p=head->next;while(p->next!=NULL)p=p->next;while(flag){s=(student*)malloc(sizeof(student));printf("输入姓名:(输入0退出):");gets(s->name);if(!strcmp(s->name,"0")){...

求一个C语言程序(学生资料管理系统),需要详细解答
学生信息包括:学号,姓名,年龄,性别,出生年月,地址,电话,E-mail等。试设计一学生信息管理系统,使之能提供以... 只有今天一天,需要对每一个部分进行讲解,采纳答案后会追加财富。学生信息包括:学号,姓名,年龄,性别,出生年月,地址,电话,E-mail等。试设计一学生信息管理系统,使之能提供以下功能:系统以菜单方式工作...

C语言 基于数组的"学生信息管理系统"
buff[100],buff_data[100][200],c;char id[30],name[20],age[10];while(1){printf("欢迎使用学生管理系统\\n1.添加学生信息\\n2.查看学生信息\\n3.删除学生信息\\n4.插入学生信息\\n5.清空所有信息\\n6.退出系统\\n\\n输入序号:");scanf("%d",&n);switch(n){case 1:{if((fd = open("...

信息管理与信息系统都学什么?
网络营销基础与实践、统计学、财务管理、运筹学等 计算机类专业课程:C语言程序设计、计算机硬件技术概论、网页设计与制作技术、数据库应用、数据结构、面向对象程序设计(Java)、管理应用软件开发、电子商务概论、信息系统分析设计、管理信息系统、计算机网络、信息安全概论、JSP基础教程、系统工程等。

北京大学信息管理专业简介
信息管理系始建于1947年,是我国最早成立的培养信息管理人才的教学机构之一,曾拥有王重民先生、刘国钧先生等著名的学术大家。 信息资源是现代社会的重要战略资源,是发展知识经济的基础。信息管理系是以研究信息资源管理的理论、技术、方法、经济、政策等为核心的学科组合体,以面向大信息和文理兼容为特色...

c语言学生信息系统管理中,输入男女用m和f表示时,输入错误则提示重新输入...
完全错误,gender 是该函数中的局部变量,是程序中的形参,将数据存在形参里面没有意义。改成这样 char inputgender(){ \/\/累赘定义不要,删掉 char gender;printf("\\n(3)请输入学生性别,‘m’代表女生,‘f’代表男生:");scanf("%c",&gender); \/\/gender 是 char 变量不是数组,不能用字...

c语言学生学籍管理系统
已知要求管理的学生信息包括:学号、姓名、性别、年龄。设计一个程序,完成如下功能:(1)能从键盘上输入若干学生的信息(2)能将学生的信息保存到磁盘上(3)能从指定的磁盘文件中读... 已知要求管理的学生信息包括:学号、姓名、性别、年龄。设计一个程序,完成如下功能:(1)能从键盘上输入若干学生的信息(2)能将学生的...

C语言程序设计题目:学生信息管理系统设计
\/* 简易学生信息管理系统 win-tc和Dev-c++下运行良好,注意不是vc++下*\/ include<stdio.h> include<stdlib.h> include<string.h> define BUFLEN 80 \/* 缓冲区最大字符数 *\/ define LEN 20 \/* 学号和姓名最大字符数,实际请更改 *\/ define N 200 \/* 最大学生人数,实际请更改*\/ struct ...

卢湾区15189826974: 用C语言编写一个学生信息管理系统
靳虞消咳: #include "stdio.h" #include "stdlib.h" #include "string.h" #include "conio.h" jiemian();struct student { char name[50]; char sex[5]; int age; char num[50]; float score1; float score2; float score3; float sum; float ave;}stu[50],del; void gn1() {int...

卢湾区15189826974: c语言程序设计:学生信息管理系统设
靳虞消咳: 1.录入2.显示3.排序4.查询5.修改6.删除7.退出 学号","姓名","成绩一","成绩二","平均成绩

卢湾区15189826974: 用C语言编写一个学生管理系统
靳虞消咳: #include<stdio.h> #include <stdlib.h> #include<process.h> // exit() #define MAX 3 typedef struct stu { int num;char name[4];float sroce[3];float sum;float ave; }student; typedef struct stuList {student data; }StuList; void Cretestu(StuList stu[])//建立 ...

卢湾区15189826974: 用c语言做一个学生管理系统 -
靳虞消咳: struct stu {char a[10]; int i; int j; int k; int m; int n; int x; }; int sum(struct stu p) {int sum=p.i+p.j+p.k+p.m+p.n; return sum;} main() {struct stu p[6],ac; int l,a[6],b; for(l=0;l{scanf("%s%d%d%d%d%d",p[l].a,&p[l].i,&p[l].j,&p[l].k,&p[l].m,&p[l].n); p[l].x=sum(p[l])...

卢湾区15189826974: C语言编写一个学生信息管理系统,求原代码谢谢
靳虞消咳: #include <iostream> #include "conio.h" #include "malloc.h" #include "windows.h" using namespace std; typedef struct { char name[20]; int stunum; int score; }StuElem;class StuList { private: StuElem *StuElem1; int Length; int MaxContine; ...

卢湾区15189826974: c语言学生信息管理系统 -
靳虞消咳: #include #include struct student{int no;char name[20];float score[2];float avg;};struct student input(); //单个学员信息录入void display(struct student [],int); //显示所有学员信息void sort(struct student [],int); //排序int find(struct student[],int,int); ...

卢湾区15189826974: 如何用C语言编写学生信息管理系统 -
靳虞消咳: 参考如下学生信息管理系统的C源代码吧.#include <stdio.h>#include <string.h>/*定义学生结构体*/ struct Student { char ID[20]; char Name[20]; float Mark1; float Mark2; float Mark3; float Average; };/*声明学生数组及学生数量*/ struct Student ...

卢湾区15189826974: 学生信息管理系统C语言怎么做 -
靳虞消咳: 跟别人问重复了,你们难道是一个老师教的啊? 网上很多类似的,你参考下:#include <stdio.h>#include <string.h> struct student { char name[30]; float math; float chinese; float english; float average; }; int MenuChoice(void); int EnterAccount(void);...

卢湾区15189826974: c语言编写学生信息管理系统 -
靳虞消咳: #include"stdio.h" #define SIZE 100000 #include"string.h" #include"stdlib.h" #include"conio.h" struct student {int n; int num; char name[10]; int C; int Maths; int En; float ave; }stu[SIZE]; /*录入数据*/ void finput() { FILE *fp; int i,p; fp=fopen(...

卢湾区15189826974: C语言学生信息管理系统
靳虞消咳: #include #define LEN sizeof(struct student) #define n 10 struct student *p[n+1]; struct student { char num[30]; char name[20]; char sex[10]; int age; char native[20]; char tele[30]; char email[30]; struct student*next; }; void main() { void chose(int a); int b;...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网