学生管理系统(部分内容1)

注:

本学生管理系统基于Visual Studio 2022版本书写且采用函数嵌套使用。以下C语言代码,均缺少头文件以及函数调用模块代码,仅供学习者,参考书写,如需完整代码,可查看博主主页资源分享!!!!

void Welcome();//欢迎界面

采用延迟,循环和色彩,做出动态加载效果。

void Welcome()
{
	int i;
	system("cls");//清屏闪烁
	for (i = 0; i <= 100; i = i + 10)
	{
		system("cls");
		printf("\n\n\n\n\t\t\t\t************\n");
		printf("\t\t\t\t  Welcome!\n");
		printf("\t\t\t\t************\n");
		printf("\n\t\t\t\t    %d%\n\n\n", i);
		Sleep(60);
	}
	system("Color a");
	Sleep(200);
	system("Color b");
	Sleep(200);
	system("Color c");
	Sleep(200);
	system("Color d");
	Sleep(200);
	system("Color e");
	Sleep(200);
	system("Color f");
	Sleep(200);
	system("Color 3e");
}

void Lo_si();//注册登录界面

通过switch语言,来实现选择性进入。

//注册登录界面
void Lo_si()
{
	int choose, ch;
	system("color 3e");
	while (1) {
		system("cls");
		printf("\t\t\t--------------------------------------\n");
		printf("\t\t\t|          登 录 选 择 系 统          |\n");
		printf("\t\t\t--------------------------------------\n");
		printf("\t\t\t菜单:\n\t\t\t1.注册账户\n\t\t\t2.登录\n\t\t\t0.结束\n");
		printf("\t\t\t--------------------------------------\n");
		printf("\t\t\t请输入您的选择(1,2,0?):\n");
		printf("\t\t\t");
		scanf("%d", &choose);
		switch (choose) {
		case 1:
			Sign();
			break;
		case 2:
			Login();
			break;
		case 0:
			Thanks();
			exit(0);
		default:
			printf("输入错误!是否重新输入【Y\\y or N\\n】\n");
			printf("\n\t\t\tchoose:");
			getchar();
			ch = getchar();
			if (ch == 'Y' || ch == 'y')
				continue;
			else
				return;
		}
	}
}

void Sign();//注册系统

采用文件储存账号信息,以满足多账户,选择性登录,同时采用if—else语言,实现判断登录。

//注册系统
void Sign()
{
	FILE* fp;
	User user;
	int num = 1;
	char ch;
	char repassword[20];
	do {
		system("cls");
		printf("\t\t\t-----------------------------------\n");
		printf("\t\t\t|          账户 注 册 系 统       |\n");
		printf("\t\t\t-----------------------------------\n");
		printf("\t\t\t请输入用户名:");
		scanf("%s", user.username);
		printf("\n\t\t\t请输入密码:");
		scanf("%s", user.password);
		if ((fp = fopen("users.txt", "a")) == NULL) {
			printf("\n\n\t\t\tusers.txt 打开失败!\n");
			exit(0);
		}
		printf("\n\n\t\t\t确认密码:");
		scanf("%s", repassword);
		if (strcmp(user.password, repassword) != 0)//比较字符串是否一样
		{
			printf("\n\t\t密码输入不一致!\t是否重新输入?【Y\\y  or  N\\n】");
			printf("\n\t\t\tchoose:");
			printf("\t\t\t");
			getchar();
			ch = getchar();//将getchar的读取的字符储存在ch中
			if (ch == 'Y' || ch == 'y')
				continue;
			else
				return;
		}
		fprintf(fp, "%s %s\n", user.username, user.password);
		fclose(fp);
		printf("\n\n\t\t\t注册成功!\n");
		system("pause");
		num = 1;
	} while (num != 1);
}


 

  • 6
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值