From e5e19989c238bb6a4eef7ec2c6aa55c140fa2b03 Mon Sep 17 00:00:00 2001 From: p08321647 <2624995441@qq.com> Date: Fri, 11 Jan 2019 19:43:42 +0800 Subject: [PATCH] first commit --- 学生成绩记录簿(1).cpp | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 学生成绩记录簿(1).cpp diff --git a/学生成绩记录簿(1).cpp b/学生成绩记录簿(1).cpp new file mode 100644 index 0000000..f8a16f4 --- /dev/null +++ b/学生成绩记录簿(1).cpp @@ -0,0 +1,47 @@ +#include +#include +struct stu //ýṹ庯 +{ + char name[10]; + int ID,score,R; + int exist; +} a[100]; +void menu() +{ + puts("Ӧַѡ"); + puts("a ӳɼ¼"); + puts("b ޸ijɼ"); + puts("c ʾɼϸϢ"); + puts("e ޸IJ˳ϵͳ"); + puts("d ɾijѧϢ"); +} +int main() +{ + char buf[1005]; //ַ + freopen("datain.txt","r",stdin);//ļ + int cnt=0; + while(fgets(buf,1000,stdin))//õļеһַ + { + sscanf(buf,"%s %d %d",a[cnt].name,&a[cnt].ID,&a[cnt].score); + a[cnt].exist=1; // + cnt++; + } + puts("ıϢ"); + freopen("CON","r",stdin);//´ļ + menu(); + while(gets(buf)) + { + if(buf[0]=='e') break; //жָ + if(buf[0]=='a') + { + puts("ʼӳɼ¼ϺESC˳"); + while(fgets(buf,1000,stdin)) + { + if(strcmp(buf,"ESC\n")==0) break;//ȽǷ + sscanf(buf,"%s %d %d",a[cnt].name,&a[cnt].ID,&a[cnt].score); + a[cnt].exist=1; // + cnt++; + } + } + } + }