40 lines
811 B
C++
40 lines
811 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;
|
|
} |