又到了课设的时间,之前学院老师提过,切勿让同学们直接复制粘贴代码,课设和此代码旨在让没有任何思路的人同学了解代码的大概写法和思路,故细节之处受人嘱托设置存在一定问题(类似代码改错,如果会改此份代码,那自行编写肯定不会是问题),切勿直接复制,看完此代码应自行编写。
贴上一年前刚刚接触C语言时候编写的代码
#include<stdio.h>
#include<string.h>
int N;
typedef struct information //定义结构体类型
{
char num; //编号
char position[50]; //账号位置
char description[50]; //账户描述(请用英文表示)
char name[50]; //账户名
char code[20]; //账户密码
} INFORMATION;
int menu_select();
int input(INFORMATION *infor,int n);
void print(INFORMATION *infor,int n);
void search(INFORMATION *infor,int n);
void modify(INFORMATION *infor,int n);
int Delete(INFORMATION *infor,int n);
void filewrite(INFORMATION *infor,int n);
int fileread(INFORMATION *infor);
int main()
{
int i,judge=0;
char code[50]={"hnust"},check[50]; //标准密码为hnust
printf(" 隐私管理系统:\n");
printf("*********************************************************\n");
printf("用户验证请输入您的密码:\n");
for(i=1;i<=3;i++)
{
scanf("%s",check);
if(!strcmp(code,check))
{
printf("口令正确\n");
judge=1;
break;
}
else
{
if(i==3)
printf("您是非法用户\n");
else
printf("口令输入错误,请重新输入\n");
}
}
int n=0;
INFORMATION information[20];
if(judge)
{
while(1)
{
switch(menu_select())
{
case 1:
n=input(information,n);
break;
case 2:
print(information,n);
break;
case 3:
search(information,n);
break;
case 4:
n=Delete(information,n);
break;
case 5:
modi