commit f8146cf99ff4ffe884be35794d51c08d8a22c88c Author: unknown <18408000232@stu.hut.edu.cn> Date: Wed Jan 9 20:04:25 2019 +0800 first commit diff --git a/终极版学生信息管理系统.cpp b/终极版学生信息管理系统.cpp new file mode 100644 index 0000000..adfab78 --- /dev/null +++ b/终极版学生信息管理系统.cpp @@ -0,0 +1,193 @@ +#include +#include +#include +#include +#include + +FILE *fp;//ļָ +int i_entry=0;//ѧͳ +#define MIN_C 100//ÿݶӦַռݵĴС +#define MAX_G 1000//ѧϢС +struct student { + char stuid[MIN_C];//ѧѧ + char name[MIN_C];//ѧ + char age[3];//ѧ + char gender[MIN_C];//ѧԱ + char birth[MIN_C];//ѧ + char add[MIN_C];//ѧַ + char tle[MIN_C];//ѧ绰 + char email[MIN_C];//ѧ +}DATA[MAX_G]; + + +struct student temp[MAX_G];//м +struct student are; + + +// +void init();//ļijʼ +void GREEN();//̨ɫΪɫ +void RED();//̨ǰɫΪɫ +void LIGHT();//̨ǰɫΪǿ + +void deal();// +//dell()Զ庯 +void notice();//ʾϢ +void case1();//ѧۺϢ¼ +void entry(); +void file_save(); + +void case2();//ѧۺϢ +void i_printf(); + +void case3();//ۺϢ +void stuid_sort(int I,int L); +void name_sort(int I,int L); + +void case4();//ѧϢѯ +void stuid_find(); +void name_find(); + +void case5();//ѧۺϢ޸ +void Change(int x); + + + + + +int main() +{ GREEN(); + printf(">********* ><ӭʹѧϢϵͳ *********<\n"); + printf(">********* ȷ룬δ˳ϵͳŶ\n"); + int u=3; + + char s[15]; + while(u--) + {if(u==2) + printf(" ȷ ") ; + else + printf("ף"); + scanf("%s",s); + if(strcmp("asdfghjkl",s)==0) + { + break; + + } + else + continue; + } + if(u==0) + { GREEN(); + printf(" ******* sorry\n"); + return 0; + } + else + { + if((fp=fopen("student_data.txt","r+"))==NULL) + { + printf("FILE\n"); + fp=fopen("student_data.txt","w+"); + } + init();//ļijʼ + LIGHT(); + printf("ǰ%d\n",i_entry); + GREEN();//̨ɫΪɫ + printf(">********** ӭʹѧϢϵͳ1.1 **********<\n"); + printf(">********** Ӧֽв **********<\n"); + printf(">**********ȷȷ˳򣬷ļܱ档**********<\n"); + deal();// + fclose(fp);//ļر + return 0; +}} + +void init() //ļijʼȡ +{ + while (!feof(fp)) + { + fscanf(fp, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", DATA[i_entry].stuid, DATA[i_entry].name, DATA[i_entry].age, + DATA[i_entry].gender, DATA[i_entry].birth, DATA[i_entry].add, DATA[i_entry].tle, DATA[i_entry].email); + i_entry++; + } +} + +void RED() {//̨ǰɫΪɫ + HANDLE kai_1 = GetStdHandle(STD_OUTPUT_HANDLE); + SetConsoleTextAttribute(kai_1, FOREGROUND_INTENSITY | FOREGROUND_RED); // Ϊɫ +} + +void GREEN() {//̨ǰɫΪɫ + HANDLE kai_2 = GetStdHandle(STD_OUTPUT_HANDLE); + SetConsoleTextAttribute(kai_2, FOREGROUND_INTENSITY | FOREGROUND_GREEN);// Ϊɫ +} +void LIGHT(){ + HANDLE kai_2 = GetStdHandle(STD_OUTPUT_HANDLE); + SetConsoleTextAttribute(kai_2, FOREGROUND_INTENSITY | FOREGROUND_INTENSITY);// Ϊǿ +} + +void deal() {//Ҫ + int k,flag,p; + p=1; + notice(); + flag=1; + while(flag) { + if(p>1) + { + system("cls"); + notice(); + } + scanf("%d",&k); + system("cls"); + switch(k) { + case 0: { + puts("ܰѣ"); + puts("\t ^^^^лл֧,ӭٴʹ!^^^^ "); + puts("\t*******ѧϢѱڵǰĿ¼ļ student_data.txt ********"); + flag=0; + LIGHT(); + break; + } + case 1: { + case1(); + break; + } + case 2: { + case2(); + break; + } + case 3: { + case3(); + break; + } + case 4: { + case4(); + break; + } + case 5: { + case5(); + break; + } + default: { + RED(); + printf("ȷǰ֣\n"); + GREEN(); + break; + } + } + p=1103; + puts("\n"); + } +} + +void notice() {//ʾϢ + RED(); + puts("\t\t\t1.ѧۺϢ¼"); + puts("\t\t\t2.ѧۺϢ"); + puts("\t\t\t3.ۺϢ"); + puts("\t\t\t4.ѧϢѯ"); + puts("\t\t\t5.ѧۺϢ޸"); + printf("\t\t\t0. ϵ ͳ\n"); + GREEN(); + printf("룺"); +} + +