⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 add_user.cpp

📁 C语言的课程设计。图书管理系统。有一些系统功能不怎么完善
💻 CPP
字号:
#include"stdio.h"
#include"iostream.h"
#include"acridine.h"
#include"malloc.h"
#include"string.h"
#include"stdlib.h"

void limit_name(char a[]);//名字的限制输入,只能包括汉字和字母
void limit_phone(char a[]);//电话的限制输入,只能包括数字。
void choose_sex(char a[]);//让用户选择性别的函数
void code_protect(char a[]);
int jiance(user *yonghu0,int &flag);//检测新注册的用户名是否已经被用过,当flag为1时,表示用户名合法,为0时,非法
int judge_number(int &i,char string[]);


void adduser()//增加会员函数
{
		user *yonghu;
		int flag;
		int i;
		char n[2];
		n[0]=-1;
		char ch;
		char a[16],b[16];
		yonghu=(user*)malloc(sizeof(user));
		yonghu->next=NULL;
  loop2:flag=1;
         cout<<"          ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆"<<endl;
	    printf("          ◆                     注册系统                   ◆\n");
		 cout<<"          ◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆◆"<<endl;
		yonghu->borrow_num=0;
		printf("          请输入姓名(一定要为真实姓名,一经写下就不能更改!)\n");
		limit_name(yonghu->true_name);
		printf("     请输入用户名\n");
		limit_name(yonghu->user_name);
		printf("     你的性别为\n          1 male\n          2 female\n");
		choose_sex(yonghu->sex);
		printf("     请输入电话\n");
		limit_phone(yonghu->phone);
  loop3:printf("     请输入密码");
		code_protect(yonghu->code);
		strcpy(a,yonghu->code);
		printf("\n");
		printf("     请再一次输入密码");
		code_protect(yonghu->code);
		strcpy(b,yonghu->code);
		printf("\n");
		if(strcmp(a,b)!=0)
		{	
			printf("     密码不一致,请重新输入\n");
			goto loop3;
		}
		yonghu->UserID=1;
		jiance(yonghu,flag);
		if(flag==0)
		{	
			printf("     该用户名已经存在!\n");
		loop:	cout<<"     您可以选择:"<<endl;
	         cout<<"          1.继续注册"<<endl;
	         cout<<"          0.退出"<<endl;	
			 printf("          ");
	         judge_number(i,n);
           	switch(n[0])
			{
        	case'1':
				system("cls");
	             	goto loop2;
         	case'0':
	            	break;
        	default:
			cout<<"     输入不正确!"<<endl;
			goto loop;
			
			}
		}
		if(flag==-1)
		{
			printf("     该用户的姓名已经存在,请重新输入\n");
loop4:         	cout<<"     您可以选择:"<<endl;
	         cout<<"          1.继续注册"<<endl;
	         cout<<"          0.退出"<<endl;
	         judge_number(i,n);
           	switch(n[0])
			{
        	case'1':
				system("cls");
	             	goto loop2;
         	case'0':
	            	break;
        	default:
			cout<<"     输入不正确!"<<endl;
			goto loop4;
			
			}
		}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -