From dcaab6884d27c2a6ce9a14d5d24f8aa2f29d0b8a Mon Sep 17 00:00:00 2001 From: unknown <18408000232@stu.hut.edu.cn> Date: Thu, 10 Jan 2019 18:07:33 +0800 Subject: [PATCH] first commit --- fangjun.cpp | 348 ++++++++++++++++++++++++++ 终极版学生信息管理系统.cpp | 3 +- 2 files changed, 350 insertions(+), 1 deletion(-) create mode 100644 fangjun.cpp diff --git a/fangjun.cpp b/fangjun.cpp new file mode 100644 index 0000000..026ed4e --- /dev/null +++ b/fangjun.cpp @@ -0,0 +1,348 @@ +#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("룺"); +} +//11111111111 +void case1() {//ѧۺϢ¼ + int flag; + flag=1; + while(flag) { + entry(); + LIGHT(); + printf("ʾ1,¼룻0,¼.Ƿ¼룺"); + GREEN(); + scanf("%d",&flag); + i_entry++; + } +} +void entry() {//ѧϢ¼ + int flag,i; + system("cls"); + init(); + flag=1; + puts("***************>>>>>>ǰģʽΪѧϢ¼״̬<<<<<<*************"); + printf("ѧѧţ"); + flag=1;//ʶжϸϢǷѴ + scanf("%s",&DATA[i_entry].stuid); + for(i=0; i>>>>>ǰģʽΪѧϢ״̬<<<<<<*************"); + i_printf(); +} +void i_printf() {//ѧϢ + int i,k=1; + //printf("ѧ\t\t\tԱ\t//\tϵַ\tϵ绰\tϵ"); + printf("\n"); + if(k) + { + for(i=0; i>>>>>ǰģʽѧŲѯϢ״̬<<<<<<*************"); + while(k) { + printf("ѧѧţ "); + scanf("%s",wqs); + for(i=0; i>>>>>ǰģʽѯϢ״̬<<<<<<*************"); + while(k) { + printf("ѧ "); + scanf("%s",wqs); + for(i=0; i #include #include +#include"fu.h" FILE *fp;//ļָ int i_entry=0;//ѧͳ @@ -270,7 +271,6 @@ void i_printf() {//ѧ } } - //44444444444 void case4() {//ѧϢѯ int v; @@ -348,3 +348,4 @@ void name_find() {// } +