当前位置: 首页 > wzjs >正文

网站打不开怎么做百度 竞价排名

网站打不开怎么做,百度 竞价排名,代理充值平台网站,怎样用自己的电脑,做网站使用vector实现一个简单的本地注册登录系统 注册&#xff1a;将账号密码存入vector里面&#xff0c;注意防重复判断 登录&#xff1a;判断登录的账号密码是否正确 #include <iostream> #include <vector> #include <string> #include <algorithm>us…

使用vector实现一个简单的本地注册登录系统

注册:将账号密码存入vector里面,注意防重复判断

登录:判断登录的账号密码是否正确

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>using namespace std;// 用户账户结构体
struct UserAccount {string username;string password;UserAccount(const string& uname, const string& pwd) : username(uname), password(pwd) {}
};// 账户管理系统类
class AccountSystem {
private:vector<UserAccount> accounts; // 存储所有账户// 检查用户名是否已存在bool isUsernameExist(const string& username) const {return any_of(accounts.begin(), accounts.end(), [&username](const UserAccount& acc) {return acc.username == username;});}public:// 注册新账户bool registerAccount(const string& username, const string& password) {if (username.empty() || password.empty()) {cout << "用户名和密码不能为空!" << endl;return false;}if (isUsernameExist(username)) {cout << "用户名已存在,请选择其他用户名!" << endl;return false;}accounts.emplace_back(username, password);cout << "注册成功!" << endl;return true;}// 登录验证bool login(const string& username, const string& password) const {auto it = find_if(accounts.begin(), accounts.end(), [&username](const UserAccount& acc) {return acc.username == username;});if (it == accounts.end()) {cout << "用户名不存在!" << endl;return false;}if (it->password != password) {cout << "密码错误!" << endl;return false;}cout << "登录成功!欢迎," << username << "!" << endl;return true;}// 显示所有账户(仅用于测试)void displayAllAccounts() const {cout << "\n所有注册账户:" << endl;for (const auto& acc : accounts) {cout << "用户名: " << acc.username << ", 密码: " << acc.password << endl;}}
};// 主菜单
void displayMenu() {cout << "\n===== 账户系统 =====" << endl;cout << "1. 注册" << endl;cout << "2. 登录" << endl;cout << "3. 退出" << endl;cout << "请选择操作: ";
}int main() {AccountSystem system;int choice;while (true) {displayMenu();cin >> choice;if (choice == 3) {cout << "感谢使用,再见!" << endl;break;}string username, password;switch (choice) {case 1: // 注册cout << "请输入用户名: ";cin >> username;cout << "请输入密码: ";cin >> password;system.registerAccount(username, password);break;case 2: // 登录cout << "请输入用户名: ";cin >> username;cout << "请输入密码: ";cin >> password;system.login(username, password);break;default:cout << "无效选择,请重新输入!" << endl;break;}// 测试用:显示所有账户// system.displayAllAccounts();}return 0;
}

牛客网练习:

http://www.dtcms.com/wzjs/332474.html

相关文章:

  • 电子商务网站基础建设新闻投稿
  • 有价值 网站免费建网站软件下载
  • 开发手机网站教程可口可乐搜索引擎营销案例
  • 婚纱摄影行业网站北京seo顾问外包
  • 胶南市场建设服务中心网站百度广告一天多少钱
  • 用wordpress做站群手机百度网址大全首页
  • 电子商务网站建设新闻大连seo优化
  • 自己如何建设网站优化外包服务公司
  • 织梦网站地图插件utf-8关键词seo
  • 重庆网络推广外包泰安seo排名
  • wordpress dux 1.6萧山市seo关键词排名
  • 买房咨询平台在线seo手机关键词排行推广
  • wordpress 数据库账号廊坊推广seo霸屏
  • 运营个网站需要什么条件营销技巧培训ppt
  • 北京丰台网站优化如何做网址
  • 深度系统优化网站标题
  • cms建站系统哪个好百度识图搜索网页版
  • 有什么网站可以做运动seo网络推广培训
  • 网站要怎么盈利如何做百度竞价推广
  • 济南著名网站建设2024年阳性最新症状
  • 商家网站建设模板seo关键词排名优化软件
  • 网站建设 合优网络廊坊seo排名公司
  • 网页广告设计师培训搜索引擎优化指的是
  • Springmvc网站开发实例青海seo技术培训
  • 做外贸如何通过网站精准找到老板联系方法如何做推广
  • 新手学做网站必备软件百度刷排名优化软件
  • 代码wordpress夫唯seo视频教程
  • 果麦传媒的网站怎么做的秘密入口3秒自动进入
  • 网站免费优化软件徐州百度推广电话
  • 常用网站建设软件免费推广引流平台