c语言管理系统登录界面
时间: 2023-10-03 17:10:35 浏览: 66
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <conio.h>
#define USERNAME "admin" //管理员账号
#define PASSWORD "123456" //管理员密码
//登录函数
int login()
{
char username[20], password[20];
printf("\n\n\n\n\t\t\t\t请输入管理员账号:");
scanf("%s", username);
printf("\n\t\t\t\t请输入管理员密码:");
scanf("%s", password);
if(strcmp(username, USERNAME) == 0 && strcmp(password, PASSWORD) == 0)
{
printf("\n\n\n\n\t\t\t\t登陆成功,欢迎进入学生管理系统!\n");
return 1;
}
else
{
printf("\n\n\n\n\t\t\t\t账号或密码错误,请重新输入!\n");
return 0;
}
}
int main()
{
system("title 学生管理系统"); //设置窗口标题
if(login()) //登录成功
{
//进入管理系统主界面
printf("\n\n\n\n\t\t\t\t学生管理系统主界面\n");
//...
}
else //登录失败
{
printf("\n\n\n\n\t\t\t\t登录失败,程序将退出!\n");
exit(0);
}
return 0;
}