code/old_homework/11.9_1.cpp
2024-11-15 22:53:19 +08:00

38 lines
787 B
C++

#include<iostream>
#include<string>
#include<windows.h>
using namespace std;
int main(){
string username,password;
string uname,pwd;
username = "2022110";
password = "246810"; //设置密码和用户名
cout <<"欢迎使用登录系统(demo)"<<endl; //无
cout <<"请输入用户名:"; //输入用户名
cin >>uname;
cout <<"请输入密码:";
cin >>pwd;
if (uname == username)
{
if (pwd == password)
{
cout <<"亲爱的小朋友欢迎您!";
Sleep(1000);
return 0;
}else{
cout <<"密码错误!";
Sleep(1000);
return 2;
}
}else{
cout <<"用户名不正确!";
Sleep(1000);
return 1;
}
return 0;
}