parent
aa676a4f06
commit
1f45821649
@ -0,0 +1,70 @@
|
|||||||
|
#include<stdio.h>
|
||||||
|
#include<string.h>
|
||||||
|
#include<math.h>
|
||||||
|
#define NUM 100
|
||||||
|
#define PASSWORD "KEY"
|
||||||
|
struct STU{
|
||||||
|
char spec[20]; //专业
|
||||||
|
char Number[8];//姓名
|
||||||
|
char name[20]; //姓名
|
||||||
|
int age; //年龄
|
||||||
|
char sex; //M 代表男性 W代表女性
|
||||||
|
float score //入学分数
|
||||||
|
};
|
||||||
|
int main(){
|
||||||
|
if(!verifyPassword())
|
||||||
|
return 0;//口令验证失败,退出程序
|
||||||
|
struct STU students[NUM];
|
||||||
|
int choice,length=0;
|
||||||
|
while(1){
|
||||||
|
dispMenu();
|
||||||
|
scanf("%d",&choice);
|
||||||
|
switch(choice){
|
||||||
|
/* case 1:length=input(students,length);break;//基本信息录入
|
||||||
|
case 2:output(students,length);break;//基本信息输出
|
||||||
|
case 3:query(students,length,inquiry);break;//基本信息查询
|
||||||
|
case 4:census(students,length);break;//分类统计输出
|
||||||
|
case 5:add(students,length);break;//追加学生信息
|
||||||
|
case 6:minus(students,length);break;//删除学生信息*/
|
||||||
|
case 7:return 0;//退出程序
|
||||||
|
default: printf("无效选择,请重新输入。\n"); break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
//密码验证
|
||||||
|
int verifyPassword(){
|
||||||
|
char str[100];
|
||||||
|
int n=3,i;
|
||||||
|
for(i=n;i>0;){
|
||||||
|
scanf("%s",str);
|
||||||
|
if(strcmp(str,PASSWORD)==0){
|
||||||
|
printf("密码正确。\n");
|
||||||
|
return 1;//密码正确
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
i--;
|
||||||
|
printf("密码错误,您还剩%d次机会。\n",i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("\n密码输入错误次数过多,程序退出。\n");
|
||||||
|
return 0;//密码错误,程序退出
|
||||||
|
}
|
||||||
|
//系统菜单
|
||||||
|
void dispMenu(){
|
||||||
|
printf("\n学生基本信息管理\n");
|
||||||
|
printf("1. 基本信息录入\n");
|
||||||
|
printf("2. 基本信息输出\n");
|
||||||
|
printf("3. 基本信息查询\n");
|
||||||
|
printf("4. 分类统计输出\n");
|
||||||
|
printf("5. 追加学生信息\n");
|
||||||
|
printf("6. 删除学生信息\n");
|
||||||
|
printf("7. 退出\n");
|
||||||
|
}
|
||||||
|
//基本信息录入
|
||||||
|
int input(struct STU *ps,int length){
|
||||||
|
struct STU *head;
|
||||||
|
struct STU *p1,*p2;
|
||||||
|
p1=p2=(struct STU*)malloc(sizeof(struct STU));
|
||||||
|
}
|
Loading…
Reference in new issue