600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > c语言学生管理系统write to a text file 语言编程学生成绩管理系统.doc

c语言学生管理系统write to a text file 语言编程学生成绩管理系统.doc

时间:2018-12-27 02:25:56

相关推荐

c语言学生管理系统write to a text file 语言编程学生成绩管理系统.doc

语言编程学生成绩管理系统

c语言编程-学生成绩管理系统

#include /*引用库函数*/

#include

#include

#include

typedef struct /*定义结构体数组*/

char num[10]; /*学号*/

char name[20]; /*姓名*/

int score; /*成绩*/

Student;

Student stu[80]; /*结构体数组变量*/

int menu_select /*菜单函数*/

char c;

do

system "cls" ; /*运行前清屏*/

printf "\t\t****Students' Grade Management System****\n" ; /*菜单选择*/

printf "\t\t | 1. Input Records |\n" ;

printf "\t\t | 2. Display All Records |\n" ;

printf "\t\t | 3. Sort |\n" ;

printf "\t\t | 4. Insert a Record |\n" ;

printf "\t\t | 5. Delete a Record |\n" ;

printf "\t\t | 6. Query |\n" ;

printf "\t\t | 7. Statistic |\n" ;

printf "\t\t | 8. Add Records from a Text File|\n" ;

printf "\t\t | 9. Write to a Text file |\n" ;

printf "\t\t | 0. Quit |\n" ;

printf "\t\t*****************************************\n" ;

printf "\t\t\tGive your Choice 0-9 :" ;

c getchar ;/*读入选择*/

while c '0'||c '9' ;

return c-'0' ; /*返回选择*/

int Input Student stud[],int n /*输入若干条记录*/

int i 0;

char sign,x[10]; /*x[10]为清除多余的数据所用*/

while sign! 'n'&&sign! 'N' /*判断*/

printf "\t\t\tstudent's num:" ; /*交互输入*/

scanf "\t\t\t%s",stud[n+i].num ;

printf "\t\t\tstudent's name:" ;

scanf "\t\t\t%s",stud[n+i].name ;

printf "\t\t\tstudent's score:" ;

scanf "\t\t\t%d",&stud[n+i].score ;

gets x ; /*清除多余的输入*/

printf "\t\t\tany more records? Y/N " ;

scanf "\t\t\t%c",&sign ; /*输入判断*/

i++;

return n+i ;

void Display Student stud[],int n /*显示所有记录*/

int i;

printf "\t\t\t

printf "\t\t\tnumber name score\n" ;

printf "\t\t\t

for i 1;i n+1;i++ /*循环输入*/

printf "\t\t\t%-16s%-15s%d\n",stud[i-1].num,stud[i-1].name,stud[i-1].score ;

if i 1&&i%10 0 /*每十个暂停*/

printf "\t\t\t

printf "\t\t\t" ;

system "pause" ;

printf "\t\t\t

printf "\t\t\t" ;

system "pause" ;

void Sort_by_num Student stud[],int n /*按学号排序*/

int i,j,*p,*q,s;

char t[10];

for i 0;i n-1;i++ /*冒泡法排序*/

fo

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。