主要贡献者:@铁根3415
修改:开朗的盟员
再次感谢各位对项目的支持!人多力量大!
- #include <iostream>
- #include <iomanip>
- #include <string>
- using namespace std;
- void displayMenu() {
- cout << "=== 红盟用户功能菜单 ===" << endl;
- cout << "1. 查询个人信息" << endl;
- cout << "2. 修改密码" << endl;
- cout << "3. 查看消息" << endl;
- cout << "4. 发送消息" << endl;
- cout << "5. 退出" << endl;
- cout << "=====================" << endl;
- cout << "请输入选项:";
- }
- void showUserInfo() {
- // 此处为示例,可以根据实际需求添加个人信息的显示
- cout << "=== 个人信息 ===" << endl;
- cout << "用户名:user123" << endl;
- cout << "邮箱:user123@example.com" << endl;
- cout << "手机号码:1234567890" << endl;
- cout << "================" << endl;
- }
- void changePassword() {
- string newPassword;
- cout << "请输入新密码:";
- cin >> newPassword;
- cout << "密码已修改为:" << newPassword << endl;
- }
- void viewMessages() {
- // 此处为示例,可以根据实际需求添加消息的显示
- cout << "=== 消息列表 ===" << endl;
- cout << "1. 消息1" << endl;
- cout << "2. 消息2" << endl;
- cout << "3. 消息3" << endl;
- cout << "===============" << endl;
- }
- void sendMessage() {
- string message;
- cout << "请输入消息内容:";
- cin.ignore();
- getline(std::cin, message);
- cout << "消息已发送:" << message << endl;
- }
- int main() {
- int choice;
-
- do {
- system("cls"); // 清屏命令,用于清除控制台上的内容
- displayMenu();
- cin >> choice;
-
- switch (choice) {
- case 1:
- showUserInfo();
- system("pause"); // 暂停命令,用于等待用户按任意键继续
- break;
- case 2:
- changePassword();
- system("pause");
- break;
- case 3:
- viewMessages();
- system("pause");
- break;
- case 4:
- sendMessage();
- system("pause");
- break;
- case 5:
- std::cout << "已退出。" << endl;
- break;
- default:
- std::cout << "无效的选项,请重新输入。" << endl;
- system("pause");
- break;
- }
- } while (choice != 5);
-
- return 0;
- }
复制代码
|
使用道具 举报
使用道具 举报