code/old_homework/11.9_1.cpp

40 lines
811 B
C++
Raw Normal View History

2024-12-07 09:00:11 +08:00
//登录系统(普通)
2024-11-08 22:19:37 +08:00
#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;
}