软件开发定制定制C语言实现学生成绩管理系统

C软件开发定制定制语言实现学生成绩管理系统
要求如下:
1、软件开发定制定制录入记录数据,软件开发定制定制建立一张数据表,软件开发定制定制并将数据表写入文件保存;
2、对已经保存在外存中的文件,根据系统内容设计一个计算功能,如计算总和,或平均值等,将结果显示在屏幕上;
3、对已经保存在外存中的文件,根据系统内容设计排序功能,既可以从小到大,又可以从大到小排序,将排序前后的数据表显示在屏幕上;
4、对已经保存在外存中的文件,根据系统内容设计查询功能,查询结果显示在屏幕上;
5、对已经保存在外存中的文件,进行数据记录的删除操作,重新写文件更新;
6、对已经保存在外存中的文件,进行数据记录的插入操作,重新写文件更新;
7、读入文件内容,将数据表输出在屏幕上。

程序需从D盘读出数据,需要在D盘根目录下存入如下格式数据且命名为student:

具体代码如下:

#include <stdio.h>#include <ctype.h>#include <string.h>#define N 10typedef struct student{  long studentID;  char studentName[100];  char studentSex[100];  char studentClass[100];  int score;		}STUDENT; int sum1(STUDENT stu[],int n){		int i,j,sum=0;	for(i=0;i<n;i++)	sum+=stu[i].score;    printf("学科成绩总分及平均分:%d,%d\",sum,sum/n);    	printf("\");    return 0;}int high1(STUDENT stu[],int n){	int i,j;	long t;	char c[100],x[100];		  printf("成绩由高到低排序\"); 	for(i=0;i<n-1;i++)	 for(j=i+1;j<n;j++)	   if(stu[j].score>stu[i].score) 	   { t=stu[i].studentID;stu[i].studentID=stu[j].studentID;stu[j].studentID=t;	     t=stu[i].score;stu[i].score=stu[j].score;stu[j].score=t;	     strcpy(x,stu[i].studentName);strcpy(stu[i].studentName,stu[j].studentName);strcpy(stu[j].studentName,x);	     strcpy(c,stu[i].studentSex);strcpy(stu[i].studentSex,stu[j].studentSex);strcpy(stu[j].studentSex,c);	     strcpy(c,stu[i].studentClass);strcpy(stu[i].studentClass,stu[j].studentClass);strcpy(stu[j].studentClass,c);	   }                       for(i=0;i<n;i++)  {  	printf("%d ",stu[i].studentID);  	printf("%s ",stu[i].studentName);  	printf("%s ",stu[i].studentSex);    printf("%s ",stu[i].studentClass);  	printf("%d ",stu[i].score);  	  	printf("\");   	  }  	printf("\");return 0;	}int low1(STUDENT stu[],int n){   	int i,j;	long t;	char c[100],x[100];	 printf("成绩由低到高排序(格式:学号,成绩)\"); 	for(i=0;i<n-1;i++)	 for(j=i+1;j<n;j++)	   if(stu[j].score<stu[i].score) 	   { t=stu[i].studentID;stu[i].studentID=stu[j].studentID;stu[j].studentID=t;	     t=stu[i].score;stu[i].score=stu[j].score;stu[j].score=t;	     strcpy(x,stu[i].studentName);strcpy(stu[i].studentName,stu[j].studentName);strcpy(stu[j].studentName,x);	     strcpy(c,stu[i].studentSex);strcpy(stu[i].studentSex,stu[j].studentSex);strcpy(stu[j].studentSex,c);	     strcpy(c,stu[i].studentClass);strcpy(stu[i].studentClass,stu[j].studentClass);strcpy(stu[j].studentClass,c);	   }                    for(i=0;i<n;i++)  {  	printf("%d ",stu[i].studentID);  	printf("%s ",stu[i].studentName);  	printf("%s ",stu[i].studentSex);  	printf("%s ",stu[i].studentClass);  	printf("%d ",stu[i].score);  	  	printf("\");   	  }    	printf("\");return 0;	}int chaxun1(STUDENT stu[],int n){   	int i,j,z,t=0;		   do{    printf("请输入查询的学号:");	scanf("%d",&z);    t=0;	for(i=0;i<n;i++)	 if(z==stu[i].studentID) 	 { t=1; 	printf("%d ",stu[i].studentID);  	printf("%s ",stu[i].studentName);  	printf("%s ",stu[i].studentSex);  	printf("%s ",stu[i].studentClass);  	printf("%d ",stu[i].score);    break;	 }	 if(t==0) printf("无此学号,请重新输入\");     }while(i==n);			printf("\");	return 0;}int shanchu1(STUDENT stu[],int *n){    int z,i,j,t,q=*n;     char c[20],x[20];      FILE *fp;           fp=fopen("D:\\student(s1).txt","wb+");          for(i=0;i<*n-1;i++)	 for(j=i+1;j<*n;j++)	   if(stu[j].studentID<stu[i].studentID) 	   { t=stu[i].studentID;stu[i].studentID=stu[j].studentID;stu[j].studentID=t;	     t=stu[i].score;stu[i].score=stu[j].score;stu[j].score=t;	     strcpy(x,stu[i].studentName);strcpy(stu[i].studentName,stu[j].studentName);strcpy(stu[j].studentName,x);	     strcpy(c,stu[i].studentSex);strcpy(stu[i].studentSex,stu[j].studentSex);strcpy(stu[j].studentSex,c);	     strcpy(c,stu[i].studentClass);strcpy(stu[i].studentClass,stu[j].studentClass);strcpy(stu[j].studentClass,c);	   }	 do{	 printf("请输入要删除的学号:");     scanf("%d",&z);     for(i=0;i<*n;i++)	 if(z==stu[i].studentID) break;     }while(i==*n);     for(j=i;j<*n-1;j++)     {     	stu[j].studentID=stu[j+1].studentID;     	strcpy(stu[j].studentName,stu[j+1].studentName);	    strcpy(stu[j].studentSex,stu[j+1].studentSex);	    stu[j].score=stu[j+1].score;	    strcpy(stu[j].studentClass,stu[j+1].studentClass);     		 }	 *n=*n-1;	 printf("删除后为:\");	  for(i=0;i<*n;i++)  {  	printf("%d ",stu[i].studentID);  	printf("%s ",stu[i].studentName);  	printf("%s ",stu[i].studentSex);  	printf("%s ",stu[i].studentClass);  	printf("%d ",stu[i].score);  	  	printf("\");   	  }  fprintf(fp,"%d\",*n);  for(i=0;i<*n;i++)  {  	fprintf(fp,"%d ",stu[i].studentID);  	fprintf(fp,"%s ",stu[i].studentName);  	fprintf(fp,"%s ",stu[i].studentSex);  	fprintf(fp,"%s ",stu[i].studentClass);  	fprintf(fp,"%d\",stu[i].score);  	  	printf("\");    }  *n=q;  fclose(fp);  FILE *fq;  fq=fopen("D:\\student.txt","rb+");   fscanf(fq,"%d",&t);  for(i=0;i<t;i++)  {  	fscanf(fq, "%ld",&stu[i].studentID);  	fscanf(fq, "%s",stu[i].studentName);  	fscanf(fq, "%s",stu[i].studentSex);  	fscanf(fq, "%s",stu[i].studentClass);  	fscanf(fq, "%d",&stu[i].score);  	  }  fclose(fq);  printf("已保存至D盘根目录student(s1).txt\"); 	return 0; }int charu1(STUDENT stu[],int *n){ int z,i,j,t;  char c[20],x[20];    FILE *fp;  fp=fopen("D:\\student(s2).txt","wb+");  printf("请输入插入的位置(数字 比如2):");  scanf("%d",&z);  for(j=*n;j>z;j--)  {     stu[j].studentID=stu[j-1].studentID;     	strcpy(stu[j].studentName,stu[j-1].studentName);	    strcpy(stu[j].studentSex,stu[j-1].studentSex);	    strcpy(stu[j].studentClass,stu[j-1].studentClass);	    stu[j].score=stu[j-1].score;  }   printf("请输入学号:");scanf("%d",&stu[z].studentID);  printf("请输入姓名:");scanf("%s",stu[z].studentName);  printf("请输入性别:");scanf("%s",stu[z].studentSex);  printf("请输入班级:");scanf("%s",stu[z].studentClass);   printf("请输入分数:");scanf("%d",&stu[z].score);  *n=*n+1;	 printf("插入后为:\");	  for(i=0;i<*n;i++)  {  	printf("%d ",stu[i].studentID);  	printf("%s ",stu[i].studentName);  	printf("%s ",stu[i].studentSex);  	printf("%s ",stu[i].studentClass);  	printf("%d ",stu[i].score);  	  	printf("\");   	  }    fprintf(fp,"%d\",*n);  for(i=0;i<*n;i++)  {  	fprintf(fp,"%d ",stu[i].studentID);  	fprintf(fp,"%s ",stu[i].studentName);  	fprintf(fp,"%s ",stu[i].studentSex);  	fprintf(fp,"%d ",stu[i].studentClass);  	fprintf(fp,"%d\",stu[i].score);  	  	printf("\");   	  }  printf("已保存至D盘根目录student(s2).txt\");    return 0;}int main(){  printf("学生成绩管理系统\");  FILE *fp;  fp=fopen("D:\\student.txt","rb+");  STUDENT stu[N],stu1[N];  int n,m,i,j,k,s=0,order,t;  fscanf(fp,"%d",&n);  for(i=0;i<n;i++)  {  	fscanf(fp, "%ld",&stu[i].studentID);  	fscanf(fp, "%s",stu[i].studentName);  	fscanf(fp, "%s",stu[i].studentSex);  	fscanf(fp, "%s",stu[i].studentClass);  	fscanf(fp, "%d",&stu[i].score);  	  }  printf("文本数据为:\");   for(i=0;i<n;i++)  {  	printf("%d ",stu[i].studentID);  	printf("%s ",stu[i].studentName);  	printf("%s ",stu[i].studentSex);  	printf("%s ",stu[i].studentClass);  	printf("%d ",stu[i].score);  	  	printf("\");   	  }  printf("\");     int (*sum)(STUDENT stu[],int n);  int (*low)(STUDENT stu[],int n);  int (*high)(STUDENT stu[],int n);  int (*chaxun)(STUDENT stu[],int n);  int (*shanchu)(STUDENT stu[],int *n);  int (*charu)(STUDENT stu[],int *n);    sum=sum1;high=high1;low=low1;chaxun=chaxun1;shanchu=shanchu1;charu=charu1;   		printf("输入“1”计算总分和平均分\");			printf("输入“2”给出成绩降序表\");			printf("输入“3”给出成绩升序表\");			printf("输入“4”按学号查询学生排名及成绩\");		printf("输入“5”删除相应学号数据\");		printf("输入“6”插入相应学号数据\");		printf("输入“7”计算所有\");		printf("输入“8”结束程序\");		printf("---------------------1 --------------------\");		printf("请输入:");		scanf("%d",&k);		printf("\");		while(1)		{		switch(k)		{			case 1:(*sum)(stu,n);break;			case 2:(*high)(stu,n);break;			case 3:(*low)(stu,n);break;			case 4:(*chaxun)(stu,n);break;			case 5:(*shanchu)(stu,&n);break;			case 6:(*charu)(stu,&n);break;			case 7: {			(*sum)(stu,n);			(*high)(stu,n);			(*low)(stu,n);			(*chaxun)(stu,n);			(*shanchu)(stu,&n);			(*charu)(stu,&n);				break;			} 			case 8:break;		}		if(k==8)break;		printf("请输入要执行的数字:");		scanf("%d",&k);         }	  fclose(fp);  return 0;} 
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
  • 227
  • 228
  • 229
  • 230
  • 231
  • 232
  • 233
  • 234
  • 235
  • 236
  • 237
  • 238
  • 239
  • 240
  • 241
  • 242
  • 243
  • 244
  • 245
  • 246
  • 247
  • 248
  • 249
  • 250
  • 251
  • 252
  • 253
  • 254
  • 255
  • 256
  • 257
  • 258
  • 259
  • 260
  • 261
  • 262
  • 263
  • 264
  • 265
  • 266
  • 267
  • 268
  • 269
  • 270
  • 271
  • 272
  • 273
  • 274
  • 275
  • 276
  • 277
  • 278
  • 279
  • 280
  • 281
  • 282
  • 283
  • 284
  • 285
  • 286
  • 287
  • 288
  • 289
  • 290
  • 291
  • 292
  • 293
  • 294
  • 295
  • 296
  • 297
  • 298
  • 299
  • 300
  • 301
  • 302
  • 303
  • 304
  • 305
  • 306
  • 307
  • 308
  • 309
  • 310
  • 311
  • 312
  • 313
  • 314
  • 315

程序结果如下

网站建设定制开发 软件系统开发定制 定制软件开发 软件开发定制 定制app开发 app开发定制 app开发定制公司 电商商城定制开发 定制小程序开发 定制开发小程序 客户管理系统开发定制 定制网站 定制开发 crm开发定制 开发公司 小程序开发定制 定制软件 收款定制开发 企业网站定制开发 定制化开发 android系统定制开发 定制小程序开发费用 定制设计 专注app软件定制开发 软件开发定制定制 知名网站建设定制 软件定制开发供应商 应用系统定制开发 软件系统定制开发 企业管理系统定制开发 系统定制开发