1.求C语言源代码 题目 学生成绩管理系统
2.c语言学生档案管理系统要全面的档案c档,无错的管理
3.学生成绩管理系统用C语言结构体去写要求显示学生成绩管理,学生档案管理,系统查询和统计
求C语言源代码 题目 学生成绩管理系统
#include <cstdlib>
#include <iostream>
using namespace std;
int main(int argc,源码猴岛 cs 源码 char *argv[])
{ #define UP
#define DOWN
#define INSERT
#define DEL
#define ENTER
#define KEY
#define KEY
#define KEY
#define KEY
#define KEY A
#define KEY B
#define KEY C
#define KEY D
#define KEY E
#define KEY F
#define KEY G
#define KEY H
#define KEY I
#define KEY K
#define KEY L
#define KEY M
#define KEY N
#define KEY O
#define KEY P
#define KEY Q
#define KEY R
#define KEY S
#define KEY T
#define KEY U
#define KEY V
#define KEY W
#define KEY X
#define KEY Y
#define KEY Z
#define ALT F2
#define ALT F6
#define CTRL 4
#define SHIFT 1
#define ESC 1
#define BACKSPACE
#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[]="NONAME.dat";
/*开辟保存数据的空间*/
void *buf=0;
int left,top,right,bottom;
/*开辟保存数据的空间*/
struct student
{ long num;
char name[];
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[];
long student number=0;
char student name[];
float student score=0;
/*读键扫描码*/
char get key(void)
{ AH=0; int (0X); return( AH); }
/*显示字符*/
void show char(char z)
{ AL=z; AH=0x0e; int (0x);}
/*测试是否有键输入*/
int key pressed(void)
{ AH=0x0b; int (0x); 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,,,0x0f);
cur show(); gotoxy(1,1); exit(1);
}
/*回到dos提示符*/
void os shell(void)
{ void mainmenu show(void);
window(1,1,,,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,0x,p,);
for(i=0;i<;i++) if(*p++<='Z') putchar(i+4,1,*(p-1),0x);
p=mianmenu word[0];
if(menu x yes)
for(i=0;j=0;i<;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","F-Menu","Message"};
void main box(void); main box();
p=mainmenu word[0]; putstr(2,,0x,p,);
for(i=0;i<;i++) { if(*p=='F'||('0'<=*p&&*p<='9'))putchar(i+2,*p,0x); p++; }
p=mainmenu word[4]; putstr(,,0x,p,9); len=strlen(filename);
putchar(-len/2-1,2,'',0x);
for(p=filename,i=0;*p!=0;p++;i++) putchar(-len/2+i,2,*p,0x);
putchar(-len/2+len,2,'',0x);
}
/*主窗口线框*/
void main box(void)
{ int i;
for(i=1;i<=;I++) { putchar(i,2,,0x); putchar(i,,,0x);putchar(i,,,0x);}
for(i=1;i<=;i++) { putchar(1,i,,0x); putchar(,i,,0x); }
putchar(1,2,,0x); putchar(,2,,0x); putchar(1,,,0x);
putchar(,,,0x); putchar(1,,,0x); putchar(,,,0x);
}
/*显示主窗口菜单*/
voidmianmenu show (void)
{ textmode set(); cur hide();
window(1,1,,,0x1e);
window(1,1,,1,0x);
window(1,,,,0x);
main menu ; main menu ;
}
/*显示下拉菜单*/
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 F","Sort F"}};
switch(menu x)
{ case 1:
if(menu x!=menu x old)
{ menu x old=menu x; menu window(3,2,,8); menu box(3,2,,8,3,0);}
for(i=0;i<2;i++)
{ putstr(4,3+i,0x,submenu word[0][i],);
putchar(5,3+i,*(submenu word[0][i]+1),0x); }
for(i=3;i<5;i++) putstr(4,3+i,0x7-,submenu word[0][i-1],);
putchar(6,6,*(submenu word[0][2]+2),0x);
putchar(5,7,*(submenu word[0][3]+1),0x);
window(4,2+menu y1,,2+menu y1,0x0f);
if(menu y1<=2)
putstr(4,2+menu y1,0x0f,submenu word[0][menu y1-1],);
else
putstr(4,2+menu y1,0x0f,submenu word[0][menu y1-2],); break;
case 2:menu x old=menu x; menu window(,2,,8);}
for(i=0;i<5;i++)
{ putstr(,3+i,0x,submenu word[1][i],);
putchar(,3+i,*(submenu word[1][i]+1,0x); }
window(,2+menu y3,,2+menu y3,0x0f);
putstr(,2+menu y3,0x0f,submenu word[1][menu y3-1],); 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(,,,); window(,,,,0x);
putstr(,,0x,title,7); putstr(,,0x,s1,);
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(,,0x,s2,);
if(flag==1)
{ gotoxy(,); printf("Record%d",record n); }
do{ window(,,,,0x);
if(!getstring(,,))goto out ;
}while(!getstring number());
p1->num=student number;
do{ if(!getstring(,,)) goto out;
}while(!string name());
strcpy(pi->name,student name);
for(i=1;i<=3;i++)
{ do{ window(+(i-1)*8,,0x);
if(!getstring(+(i-1)*8,,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(,,,,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);
}
/*查询,删除,理系内核源码安装perf修改对话框*/
struct student*msg box(int which)
{ int flag; int key; char*p="<-A B->"; menu window(,统源,,); gotoxy(,);
printf("Number OR Name"); window(,,,,0x); gotoxy(,);
printf(" | "); gotoxy(,);
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("\");
}while(1);
putstr(,,0x,p,7);
if(flag==1)
{ do{
gotoxy(,); printf(" | "):
if(!getstring(,,)) goto out;
}while(!string number());
window(,,,,0x1e); return(search(1)); }
else
{ do{ gotoxy(,); printf(" | ");
if(!getstring(,,)) goto out;
}while(!string name());
window(,,,,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(,,,); gotoxy(,); printf("Find Fail");
putchar(,,'A',0xe4); putchar(,,'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("\"); }while(1);
window(,,,,0x1e); if(flag==1)
{ p=msg box(3); if(p==0) info(3);
else{ window(6,5,,,0x0e); window(5,4,,,0x5e); window(6,5,,,0x0e);
putstr(,4,0x5a,str,); gotoxy(6,6);
if(p!=(head-1)){ pa=p->next;p=pa;}
else p=head;
printf("%d%s%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,,,0x0e);window(5,4,,,0x5e); window(6,5,,,0x0e);
putchar(,4,0x5a,sm,); if(head)
{ pa=head; j=0;
do{ j++; i=0; window(6,5,,,0x0e); gotoxy(,);
printf("Page%d",j);
do
{ if(pa->c<||pa->h maths<||pa->english<)
{ gotoxy(6,6+i); i++;
printf("%d%s%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!=&&pa!=0);
while(!key pressed()) now time();
get key(); }while(pa!=0);
goto out;}}
while(!key pressed())
now time();get key();
out:window(5,4,,,0x1e);}
/*成绩排名*/
void sort(void)
{ int i,j,n,flag; struct student*pa=0,*pb=0;
struct student*p[],*pmin;
char*str="NO. Name H maths English C\\C++ Sum S NO.";
window(6,5,,,0x0e); window(5,4,,,0x5e); window(6,5,,,0x0e);
putstr(,4,0x5a,str,); window(,,,,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;i<n;i++)
{ flag=0;
for(j=0;j<n-i;j++)
if(p[j]->sum<p[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 n>1)
for(i=1;i<record 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,,,0x0e); gotoxy(,); printf("Page%d",j);
do
{ gotoxy(6,6+i); i++;
printf("%d%s%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!=&&pa!=0);
while(!key pressed()) now time();
get key(); }while(pa!=0);
goto out;}
while(!key pressed())
now time();get key();
out:window(5,4,,,0x1e);}
/*输入文件名*/
int input filename(int m)
{ char*p; int fp; menu window(,,,);
window(,,,,0x);
gotoxy(,); printf("File name");
if(!getstring(,,)) 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(,,,,0x1e);
return(1);
no: window(,,,,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(); }
}
/*打开文件*/
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!=0&&head!=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(,5,,); putstr(,5,0x,title,);
for(i=0;i<;i++)putstr(,6+i,0x,str[i],);
while(!key pressed()) now time();
get key(); window(,5,,,0x1e);
}
system("PAUSE");
return EXIT_SUCCESS;
}
c语言学生档案管理系统要全面的,无错的档案c档
#include<stdio.h>
#include<stdlib.h>
#include<conio.h>
#include<dos.h>
#include<string.h>
#define LEN sizeof(struct student)
#define FORMAT "%-8d%-s%-.1lf%-.1lf%-.1lf%-.1lf\n"
#define DATA stu[i].num,stu[i].name,stu[i].elec,stu[i].expe,stu[i].requ,stu[i].sum
struct student/*定义学生成绩结构体*/
{ int num;/*学号*/
char name[];/*姓名*/
double elec;/*选修课*/
double expe;/*实验课*/
double requ;/*必修课*/
double sum;/*总分*/
};
struct student stu[];/*定义结构体数组*/
void in();/*录入学生成绩信息*/
void show();/*显示学生信息*/
void order();/*按总分排序*/
void del();/*删除学生成绩信息*/
void modify();/*修改学生成绩信息*/
void menu();/*主菜单*/
void insert();/*插入学生信息*/
void total();/*计算总人数*/
void search();/*查找学生信息*/
void save();/*保存函数*/
void open();/*打开函数*/
void main()/*主函数*/
{ int n;
menu();
scanf("%d",&n);/*输入选择功能的编号*/
while(n)
{ switch(n)
{ case 1: in();break;
case 2: search();break;
case 3: del();break;
case 4: modify();break;
case 5: insert();break;
case 6: order();break;
case 7: total();break;
case 8: save();break;
case 9: open();break;
default:break;
}
getch();
menu();/*执行完功能再次显示菜单界面*/
scanf("%d",&n);
}
}
void in()/*录入学生信息*/
{ int i,m=0;/*m是记录的条数*/
char ch[2];
FILE *fp;/*定义文件指针*/
if((fp=fopen("data.txt","a+"))==NULL)/*打开指定文件*/
{ printf("无法打开\n");return;}
while(!feof(fp)) {
if(fread(&stu[m] ,LEN,1,fp)==1)
m++;/*统计当前记录条数*/
}
fclose(fp);
if(m==0)
printf("没有记录!\n");
else
{
system("cls");
show();/*调用show函数,显示原有信息*/
}
if((fp=fopen("data.txt",管理"wb"))==NULL)
{ printf("无法打开\n");return;}
for(i=0;i<m;i++) fwrite(&stu[i] ,LEN,1,fp);/*向指定的磁盘文件写入信息*/
printf("确认输入:(Y/N):");
scanf("%s",ch);
while(strcmp(ch,"Y")==0||strcmp(ch,"y")==0)/*判断是否要录入新信息*/
{
printf("学号:");scanf("%d",&stu[m].num);/*输入学生学号*/
for(i=0;i<m;i++)
if(stu[i].num==stu[m].num)
{
printf("学号存在,输入任意键继续!");
getch();
fclose(fp);
return;
}
printf("姓名:");scanf("%s",系统stu[m].name);/*输入学生姓名*/
printf("选修课:");scanf("%lf",&stu[m].elec);/*输入选修课成绩*/
printf("实验课:");scanf("%lf",&stu[m].expe);/*输入实验课成绩*/
printf("必修课:");scanf("%lf",&stu[m].requ);/*输入必修课成绩*/
stu[m].sum=stu[m].elec+stu[m].expe+stu[m].requ;/*计算出总成绩*/
if(fwrite(&stu[m],LEN,1,fp)!=1)/*将新录入的信息写入指定的磁盘文件*/
{ printf("无法保存!"); getch(); }
else { printf("%s 保持成功!\n",stu[m].name);m++;}
printf("继续?(Y/N):");/*询问是否继续*/
scanf("%s",ch);
}
fclose(fp);
printf("OK!\n");
}
void show()
{ FILE *fp;
int i,m=0;
fp=fopen("data.txt","rb");
while(!feof(fp))
{
if(fread(&stu[m] ,LEN,1,fp)==1)
m++;
}
fclose(fp);
printf("学号 姓名 选修课 实验课 必修课 总成绩\t\n");
for(i=0;i<m;i++)
{
printf(FORMAT,DATA);/*将信息按指定格式打印*/
}
}
void menu()/*自定义函数实现菜单功能*/
{
system("cls");
printf("\n\n\n\n\n");
printf("\t\t|-------------学生信息管理系统-----------by:zxl|\n");
printf("\t\t|\t 0. 退出 |\n");
printf("\t\t|\t 1. 录入学生基本信息 |\n");
printf("\t\t|\t 2. 寻找某位学生信息 |\n");
printf("\t\t|\t 3. 删除学生基本信息 |\n");
printf("\t\t|\t 4. 修改学生基本信息 |\n");
printf("\t\t|\t 5. 插入新生基本信息 |\n");
printf("\t\t|\t 6. 排序学生基本信息 |\n");
printf("\t\t|\t 7. 浏览全班学生信息 |\n");
printf("\t\t|\t 8. 保存学生信息到磁盘 |\n");
printf("\t\t|\t 9. 打开学生信息从磁盘 |\n");
printf("\t\t|-----------------------------------------------|\n\n");
printf("\t\t\t选择(0-9):");
}
void order()/*自定义排序函数*/
{ FILE *fp;
struct student t;
int i=0,j=0,m=0;
if((fp=fopen("data.txt","r+"))==NULL)
{
printf("无法打开!\n");
return;
}
while(!feof(fp))
if(fread(&stu[m] ,LEN,1,fp)==1)
m++;
fclose(fp);
if(m==0)
{
printf("没有记录!\n");
return;
}
if((fp=fopen("data.txt","wb"))==NULL)
{
printf("无法打开\n");
return;}
for(i=0;i<m-1;i++)
for(j=i+1;j<m;j++)/*双重循环实现成绩比较并交换*/
if(stu[i].sum<stu[j].sum)
{ t=stu[i];stu[i]=stu[j];stu[j]=t;}
if((fp=fopen("data.txt","wb"))==NULL)
{ printf("无法打开\n");return;}
for(i=0;i<m;i++)/*将重新排好序的内容重新写入指定的磁盘文件中*/
if(fwrite(&stu[i] ,LEN,1,fp)!=1)
{
printf("%s 无法保存!\n");
getch();
}
fclose(fp);
printf("保存成功!");
getch();
}
void del()/*自定义删除函数*/
{ FILE *fp;
int snum,i,j,m=0;
char ch[2];
if((fp=fopen("data.txt","r+"))==NULL)
{ printf("无法打开\n");return;}
while(!feof(fp)) if(fread(&stu[m],LEN,1,fp)==1) m++;
fclose(fp);
if(m==0)
{
printf("没有记录!\n");
return;
}
printf("请输入学号:");
scanf("%d",&snum);
for(i=0;i<m;i++)
if(snum==stu[i].num)
break;
printf("找到学号,删除?源码(Y/N)");
scanf("%s",ch);
if(strcmp(ch,"Y")==0||strcmp(ch,"y")==0)/*判断是否要进行删除*/
for(j=i;j<m;j++)
stu[j]=stu[j+1];/*将后一个记录移到前一个记录的位置*/
m--;/*记录的总个数减1*/
if((fp=fopen("data.txt","wb"))==NULL)
{ printf("无法打开\n");return;}
for(j=0;j<m;j++)/*将更改后的记录重新写入指定的磁盘文件中*/
if(fwrite(&stu[j] ,LEN,1,fp)!=1)
{ printf("无法保存!\n");
getch();}
fclose(fp);
printf("删除成功!\n");
getch();
}
void search()/*自定义查找函数*/
{ FILE *fp;
int snum,i,m=0;
char ch[2];
if((fp=fopen("data.txt","rb"))==NULL)
{ printf("无法打开\n");return;}
while(!feof(fp)) if(fread(&stu[m],LEN,1,fp)==1) m++;
fclose(fp);
if(m==0) { printf("没有记录!\n");return;}
printf("请输入学号:");
scanf("%d",&snum);
for(i=0;i<m;i++)
if(snum==stu[i].num)/*查找输入的学号是否在记录中*/
{ printf("找到学号,显示?案管(Y/N)");
scanf("%s",ch);
if(strcmp(ch,"Y")==0||strcmp(ch,"y")==0)
{
printf("学号 姓名 选修课 实验课 必修课 总成绩\t\n");
printf(FORMAT,DATA);/*将查找出的结果按指定格式输出*/
getch();
}break;
}
if(i==m) printf("无法找到该学生!\n");/*未找到要查找的信息*/
}
void modify()/*自定义修改函数*/
{ FILE *fp;
int i,j,m=0,snum;
if((fp=fopen("data.txt","r+"))==NULL)
{ printf("无法打开\n");return;}
while(!feof(fp))
if(fread(&stu[m],LEN,1,fp)==1) m++;
if(m==0) { printf("无记录!\n");
fclose(fp);
return;
}
printf("请输入您要修改信息的学生的学号!\n");
scanf("%d",&snum);
for(i=0;i<m;i++)
if(snum==stu[i].num)/*检索记录中是否有要修改的信息*/
break;
printf("找到学号,您可以修改!\n");
printf("姓名:");
scanf("%s",理系android 证件扫描源码stu[i].name);/*输入名字*/
printf("选修课:");
scanf("%lf",&stu[i].elec);/*输入选修课成绩*/
printf("实验课:");
scanf("%lf",&stu[i].expe);/*输入实验课成绩*/
printf("必修课:");
scanf("%lf",&stu[i].requ);/*输入必修课成绩*/
stu[i].sum=stu[i].elec+stu[i].expe+stu[i].requ;
if((fp=fopen("data.txt","wb"))==NULL)
{ printf("无法打开\n");return;}
for(j=0;j<m;j++)/*将新修改的信息写入指定的磁盘文件中*/
if(fwrite(&stu[j] ,LEN,1,fp)!=1)
{ printf("无法保存!"); getch(); }
fclose(fp);
printf("修改成功!");
getch();
}
void insert()/*自定义插入函数*/
{ FILE *fp;
int i,j,k,m=0,snum;
if((fp=fopen("data.txt","r+"))==NULL)
{ printf("无法打开\n");return;}
while(!feof(fp))
if(fread(&stu[m],LEN,1,fp)==1) m++;
if(m==0) { printf("无记录!\n");
fclose(fp);
getch();
return;
}
printf("输入要插入的位置(学号):");
scanf("%d",&snum);/*输入要插入的位置*/
for(i=0;i<m;i++)
if(snum==stu[i].num)
break;
for(j=m-1;j>i;j--)
stu[j+1]=stu[j];/*从最后一条记录开始均向后移一位*/
printf("现在请输入新信息.\n");
printf("学号:");
scanf("%d",&stu[i+1].num);
for(k=0;k<m;k++)
if(stu[k].num==stu[i+1].num)
{
printf("学号存在,按任意键继续!");
getch();
fclose(fp);
return;
}
printf("姓名:");
scanf("%s",统源stu[i+1].name);
printf("选修课:");
scanf("%lf",&stu[i+1].elec);
printf("实验课:");
scanf("%lf",&stu[i+1].expe);
printf("必修课:");
scanf("%lf",&stu[i+1].requ);
stu[i+1].sum=stu[i+1].elec+stu[i+1].expe+stu[i+1].requ;
if((fp=fopen("data.txt","wb"))==NULL)
{ printf("无法打开\n");return;}
for(k=0;k<=m;k++)
if(fwrite(&stu[k] ,LEN,1,fp)!=1)/*将修改后的记录写入磁盘文件中*/
{ printf("无法保存!"); getch(); }
fclose(fp);
printf("插入成功!");
getch();
}
void total()
{ FILE *fp;
int m=0;
if((fp=fopen("data.txt","r+"))==NULL)
{ printf("无法打开\n");return;}
while(!feof(fp))
if(fread(&stu[m],LEN,1,fp)==1)
m++;/*统计记录个数即学生个数*/
if(m==0) { printf("无记录!\n");fclose(fp);return;}
printf("本班有%d个学生!\n",m);/*将统计的个数输出*/
show();
getch();
fclose(fp);
}
这个是成绩管理系统,可行?不过都差不多,档案c档课程设计这东西很简单的20秒视频源码
学生成绩管理系统用C语言结构体去写要求显示学生成绩管理,学生档案管理,查询和统计
跟你的要求差不多,但是mac nginx 源码安装有点小差别,自己改改吧!
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define NAME_MAX //书的名字的最长字数
#define WRITER_MAX //作者名字的最长
#define PUB_MAX //出版单位最长名字
#define TIME //出版时间
typedef struct books
{
int loading;
char name[NAME_MAX];
char writer[WRITER_MAX];
int identify;
char pub[PUB_MAX];
char time[TIME];
int price;
struct books * next;
}book;
//头结点不存储信息
void Init(book * head)
{
head->next=NULL;
}
//打印一些欢迎词之类的。。。。。
void welcome()
{
printf("
2024-11-24 22:292155人浏览
2024-11-24 22:2750人浏览
2024-11-24 22:022049人浏览
2024-11-24 21:291796人浏览
2024-11-24 20:34474人浏览
2024-11-24 20:32733人浏览
1.网站源码与模板及网站管理系统区别与关系2.网站源码怎么用?3.如何直接再php后台管理系统直接修改php文件?网站源码与模板及网站管理系统区别与关系 网站源码: 就是一个网站应用程序的源代
1.koreader是什么2.云帆小说下载阅读器阅读界面koreader是什么 Koreader是一款遵循GPLv3协议的开源Kindle阅读器,它的设计理念在于提供广泛且兼容的电子书阅读体验。它