commit 1b91b5ff976e963f2123f3c7eb0b73b4d5db0888 Author: 18408000218@stu.hut.edu.cn <18408000218@stu.hut.edu.cn> Date: Tue Jan 8 20:05:32 2019 +0800 first commit diff --git a/Makefile.win b/Makefile.win new file mode 100644 index 0000000..8ea9cfc --- /dev/null +++ b/Makefile.win @@ -0,0 +1,28 @@ +# Project: 课设 +# Makefile created by Dev-C++ 5.7.1 + +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe +OBJ = main.o +LINKOBJ = main.o +LIBS = -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib" -L"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/lib" -static-libstdc++ -static-libgcc -g3 +INCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" +CXXINCS = -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/mingw32/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include" -I"C:/Program Files (x86)/Dev-Cpp/MinGW32/lib/gcc/mingw32/4.8.1/include/c++" +BIN = 课设.exe +CXXFLAGS = $(CXXINCS) -g3 -std=c99 +CFLAGS = $(INCS) -g3 -std=c99 +RM = rm.exe -f + +.PHONY: all all-before all-after clean clean-custom + +all: all-before $(BIN) all-after + +clean: clean-custom + ${RM} $(OBJ) $(BIN) + +$(BIN): $(OBJ) + $(CC) $(LINKOBJ) -o $(BIN) $(LIBS) + +main.o: main.c + $(CC) -c main.c -o main.o $(CFLAGS) diff --git a/data.txt b/data.txt new file mode 100644 index 0000000..69777b8 --- /dev/null +++ b/data.txt @@ -0,0 +1 @@ +18408000218 周庆 1 1 1 diff --git a/data2.txt b/data2.txt new file mode 100644 index 0000000..e69de29 diff --git a/head.h b/head.h new file mode 100644 index 0000000..91c09d7 --- /dev/null +++ b/head.h @@ -0,0 +1,14 @@ +void menus(); +void input(); +void display(); +void save(); +int my_delete(); +int alter(); +void demand(); +void _menus(); +void end(); +int login(); +int password(); +int cpassword(); +void out(); +void _menus2(); diff --git a/main.c b/main.c new file mode 100644 index 0000000..4174ee4 --- /dev/null +++ b/main.c @@ -0,0 +1,274 @@ +#include +#include +#include +#include +#include +#include +//#include +#include "head.h" + +/* run this program using the console pauser or add your own getch, system("pause") or input loop */ + +int num=0;//当前数组中存储的数据量 +struct node{ + char stnum[20]; + char stname[20]; + char sex[8]; + int age; + char detail[100]; +}student[1000]; + +int main(int argc, char *argv[]) { + + //if(!login())return 0; + menus(); + char choice; + while(1){ + printf("请输入正确选项!\n"); + choice=getch(); + system("cls"); + switch(choice){ + case '1': + input(); + end(); + break; + case '2': + display(); + break; + case '3': + printf("\a保存后将退出系统\n是否继续?\n继续则输入'Y'\n按其他任意键取消\n"); + char ch; + ch=getch(); + if(ch=='Y'){ + save(); + out(); + return 0; + } + break; + case '4': + if(my_delete()!=1){ + out(); + return 0; + } + break; + case '5': + if(alter()!=1){ + out(); + return 0; + } + break; + + default: + system("cls"); + end(); + break; + } + system("cls"); + menus(); + } + return 0; +} + +void out() +{ + system("cls"); + printf("本次使用到此结束!\n即将退出程序!\n"); + for(int i=3;i>0;i--){ + printf("%d秒后退出程序!\n",i); + Sleep(1000); + } +} + +void menus() +{ + printf("\t\t\t\t**********请选择系统功能选项**************\n"); + printf("\t\t\t\t*--------1 学生基本信息录入--------------*\n"); + printf("\t\t\t\t*--------2 学生基本信息显示--------------*\n"); + printf("\t\t\t\t*--------3 学生基本信息保存--------------*\n"); + printf("\t\t\t\t*---4 学生基本信息删除(此选项须输入密码)-*\n"); + printf("\t\t\t\t*---5 学生基本信息修改(此选项须输入密码)-*\n"); + printf("\t\t\t\t******************************************\n\n"); +} + +void input() +{ + int n=0; + char c='0'; + int falg=1; + printf("请输入你要录入的学生信息数:\n"); + do{ + c=getch(); + if(c>'9'||c<'0'){ + printf("数值非法!!!\n请重新输入!\n"); + } + }while(c>'9'||c<'0'); + n=c-'0'; + printf("你选择录入%d名学生!\n",n); + if(num+n+1>=1000){ + printf("本次录入只能录入%d名学生!\n",1000-num-1); + falg=0; + } + for(int i=num;i