代码拉取完成,页面将自动刷新
#include<iostream>
#include<string>
#include<algorithm>
#include<numeric>
#include<cstdio>
#include<fstream>
#include<ctime>
#include<cctype>
#include<vector>
#include<filesystem>
#include<chrono>
#include"global.h"
#include"month.h"
#include"riqi.h"
#include"day.h"
#include"schedule.h"
#include"main_interface.h"
#include"year.h"
#include"user.h"
#include"dialogue.h"
using namespace std;
//函数
const std::vector<year> get_year_vec();
//void welcome_interface();
void print_daiban_schedule();
string user_func(user u);
void list_chengyuan(vector<user>& user_vec);
//string get_wps_path();
//变量
vector<riqi>riqi_vec;//personal
vector<riqi>shared_riqi_vec;//shared
std::vector<year> year_vec = get_year_vec();
vector<user>user_vec = {user("user_name","user_secret","群主")};
vector<dialogue>dialogue_vec;
unsigned int message_number;
bool wuxinxiaoxi = true;
int main()
{
std::filesystem::path new_folder_path = "G:/我的云端硬盘/Multi-function_calendar_data";
std::filesystem::create_directories(new_folder_path);
//ofstream ofile2("G:/我的云端硬盘/Multi-function_calendar_data/users");
//if(!ofile2.is_open())
//{
// std::cout << f_red << "操作失败:无法打开文件!" << reset << endl;
// return 1;
//}
//ifstream ifile2("G:/我的云端硬盘/Multi-function_calendar_data/users");
//if(!ifile2.is_open())
//{
// std::cout << f_red << "操作失败:无法打开文件!" << reset << endl;
// return 2;
//}
/*vector<string>user_name_vec;
auto iter=back_inserter<vector<string>>(user_name_vec);
for(unsigned int i = 1;i <= 64;++i)
{
iter = std::to_string(i);
}*/
ofstream o_users_file;
o_users_file.open("G:/我的云端硬盘/Multi-function_calendar_data/users", ofstream::app);
if (!o_users_file.is_open())
{
cout << "操作失败:无法打开文件!" << endl;
return 5;
}
o_users_file.close();
ofstream o_dialogue_file;
o_dialogue_file.open("G:/我的云端硬盘/Multi-function_calendar_data/dialogue", ofstream::app);
if(!o_dialogue_file.is_open())
{
cout << "操作失败:无法打开文件!" << endl;
return -12;
}
o_dialogue_file.close();
ifstream i_users_file("G:/我的云端硬盘/Multi-function_calendar_data/users");
if(!i_users_file.is_open())
{
cout << "操作失败:无法打开文件!" << endl;
return 11;
}
//局部变量
string user_name;
string user_secret;
string user_shenfen;
getline(i_users_file, user_name);
getline(i_users_file, user_secret);
getline(i_users_file, user_shenfen);//消耗首个用户
while (getline(i_users_file, user_name)&& getline(i_users_file, user_secret)&& getline(i_users_file, user_shenfen))
{
user_vec.emplace_back(user_name,user_secret,user_shenfen);
}
ifstream i_dialogue_file("G:/我的云端硬盘/Multi-function_calendar_data/dialogue");
if(!i_dialogue_file.is_open())
{
cout << "操作失败:无法打开文件!" << endl;
return -13;
}
string message;
while(getline(i_dialogue_file, user_name) &&getline(i_dialogue_file, message))
{
int64_t count;
i_dialogue_file >> count;
i_dialogue_file.ignore();
std::chrono::time_point<std::chrono::steady_clock> produce_time = int64_to_time_point(count);
dialogue_vec.emplace_back(user_name, message,produce_time);
}
cout << "欢迎来到团队协作日历!\nl:登录\nr:注册\nc:注销\nv:查看用户\ne:退出\n";
while (true)
{
cout << "~$ ";
while (std::cin.peek() == '\n')
{
cout << "~$ ";
std::cin.ignore();
}
string command = "";
cin >> command;
if (command == "l")//log in
{
cin.ignore(std::numeric_limits<streamsize>::max(), '\n');
cout << "(按q退出)用户名:";
while (std::cin.peek() == '\n')
{
cout << "(按q退出)用户名:";
std::cin.ignore();
}
cin >> user_name;
if(user_name == "q")
{
cin.ignore();
continue;
}
/*auto iter2 = find(user_name_vec.cbegin(),user_name_vec.cend(),user_name);*/
if (user_vec.end()==find_if(user_vec.begin(),user_vec.end(),[&user_name](const user&u)->bool{return (u.get_user_name()==user_name);}))
{
cin.ignore();
cout << f_red << "操作失败:该用户不存在!" << reset << endl;
continue;
}
else//用户名正确
{
cin.ignore();
auto iter = find_if(user_vec.begin(), user_vec.end(), [&user_name](const user& u)->bool{return u.get_user_name() == user_name; });
cout << "(按q退出)密码:";
while(std::cin.peek() == '\n')
{
cout << "(按q退出)密码:";
std::cin.ignore();
}
cin >> user_secret;
cin.ignore();
if(user_secret == "q")
{
continue;
}
else if(user_secret == iter->get_user_secret())//密码正确
{
string s = user_func(*iter);
if(s == "back"||s=="b")
{
cin.ignore();
system("cls");
cout << "欢迎来到团队协作日历!\nl:登录\nr:注册\nc:注销\nv:查看用户\ne:退出\n" << reset;
continue;
}
else if(s == "exit"||s=="e")
{
cout << f_green << "感谢使用!" << reset << endl;
break;
}
else
{
cout << f_red << "程序异常终止!" << reset << endl;
exit(6);
}
}
else
{
cout << f_red << "操作失败:密码错误!" << reset << endl;
continue;
}
}
}
else if (command == "r")//register
{
cin.ignore(std::numeric_limits<streamsize>::max(), '\n');
cout << "(按q退出)用户名:";
while (std::cin.peek() == '\n')
{
cout << "(按q退出)用户名:";
std::cin.ignore();
}
cin >> user_name;
if(user_name == "q")
{
cin.ignore();
continue;
}
if (!(user_vec.end() ==
find_if(user_vec.begin(), user_vec.end(), [&user_name](const user& u)->bool{return (user_name==u.get_user_name()); })))//已存在
{
cin.ignore();
cout << f_red << "操作失败:该用户已经存在!" << reset << endl;
continue;
}
else//用户名合法
{
cin.ignore();
cout << "(按q退出)密码:";
while(std::cin.peek() == '\n')
{
cout << "(按q退出)密码:";
std::cin.ignore();
}
cin >> user_secret;
cin.ignore();
if(user_secret == "q")
{
continue;
}
if(user_secret.size() <= 5)
{
cout << f_red << "操作失败:密码至少应有6位数!"<<reset << endl;
continue;
}
user_vec.emplace_back(user_name,user_secret,"群成员");
cout << f_green << "注册成功!" << reset<<endl;
continue;
}
}
else if (command == "c")
{
cin.ignore(std::numeric_limits<streamsize>::max(), '\n');
cout << "(按q退出)用户名:";
while (std::cin.peek() == '\n')
{
cout << "(按q退出)用户名:";
std::cin.ignore();
}
cin >> user_name;
if(user_name == "q")
{
cin.ignore();
continue;
}
else if(user_name == "lisen")
{
cout <<f_red<< "操作失败:不能注销群主!" << reset << endl;
cin.ignore();
continue;
}
cin.ignore();
bool b = false;
for (auto iter = user_vec.begin(); iter != user_vec.end(); ++iter)
{
if (iter->get_user_name() == user_name)
{
cout << "(按q退出)密码:";
while(std::cin.peek() == '\n')
{
cout << "(按q退出)密码:";
std::cin.ignore();
}
cin >> user_secret;
cin.ignore();
if(user_secret == "q")
{
b = true;
break;
}
else if(user_secret == iter->get_user_secret())
{
user_vec.erase(iter);
ofstream ofile4("G:/我的云端硬盘/Multi-function_calendar_data/" + user_name, ofstream::trunc);
if(!ofile4.is_open())
{
std::cout << f_red << "操作失败:无法打开文件!" << reset << std::endl;
exit(7);
}
ofile4.close();
cout << f_green << "注销成功!" << reset << endl;
b = true;
break;
}
else
{
cout << f_red << "操作失败:密码错误!" << reset << endl;
continue;
}
}
}
if (b)
{
continue;
}
else//没有该用户
{
cout << f_red << "操作失败:该用户不存在!" << reset << endl;
continue;
}
}
else if(command == "v")
{
cin.ignore(std::numeric_limits<streamsize>::max(),'\n');
list_chengyuan(user_vec);
continue;
}
else if (command == "e")
{
cout <<f_green<< "感谢使用!"<<reset<<endl;
break;
}
else
{
cout <<f_red<< "操作失败:输入格式不正确!" <<reset<< endl;
cin.clear();
cin.ignore(std::numeric_limits<streamsize>::max(), '\n');
continue;
}
}
o_users_file.open("G:/我的云端硬盘/Multi-function_calendar_data/users");
for (auto& ele : user_vec)
{
o_users_file << ele.get_user_name() << endl;
o_users_file << ele.get_user_secret() << endl;
o_users_file << ele.get_user_shenfen() << endl;
}
o_users_file.close();
o_dialogue_file.open("G:/我的云端硬盘/Multi-function_calendar_data/dialogue");
for(auto& ele : dialogue_vec)
{
o_dialogue_file << ele.get_user_name() << endl;
o_dialogue_file << ele.get_dial() << endl;
o_dialogue_file << time_point_to_int64 (ele.get_produce_time())<< endl;
}
o_dialogue_file.close();
system("pause");
return 0;
}
void print_daiban_schedule()
{
if(wuxinxiaoxi)
{
cout << f_green << "无新消息" << reset << endl;
}
else
{
cout << f_red << "有新消息,按d查看" << reset << endl;
}
if (year_vec[now_year - 2023].get_month_arr()[now_month - 1].get_day_vec()[now_day - 1].get_schedule_number() == 0)
{
cout <<f_green<< "今天无日程" <<reset<< endl;
}
else if(year_vec[now_year - 2023].get_month_arr()[now_month - 1].get_day_vec()[now_day - 1].get_personal_schedule_number()!=0&& year_vec[now_year - 2023].get_month_arr()[now_month - 1].get_day_vec()[now_day - 1].get_team_schedule_number()==0)
{
cout <<f_red<< "今天日程" <<reset<< endl;
cout << "个人:" << endl;
int j = 1;
for (auto ele : year_vec[now_year - 2023].get_month_arr()[now_month - 1].get_day_vec()[now_day - 1].get_schedule_vec())
{
if (ele.gettype() == "person")
{
std::cout << ele.getevent() << "~" <<
ele.gettime() << "~" << ele.getsite() << "~" << ele.getbeizhu() <<"..............................."<<j <<std::endl;
++j;
}
}
/*cout << "无团队" << endl;*/
}
else if (year_vec[now_year - 2023].get_month_arr()[now_month - 1].get_day_vec()[now_day - 1].get_personal_schedule_number() == 0 && year_vec[now_year - 2023].get_month_arr()[now_month - 1].get_day_vec()[now_day - 1].get_team_schedule_number() != 0)
{
cout <<f_red<< "今天日程" <<reset<< endl;
/* cout << "无个人" << endl;*/
cout << "团队:" << endl;
int j = 1;
for (auto ele : year_vec[now_year - 2023].get_month_arr()[now_month - 1].get_day_vec()[now_day - 1].get_schedule_vec())
{
if (ele.gettype() == "team")
{
std::cout << ele.getevent() << "~" <<
ele.gettime() << "~" << ele.getsite() << "~" << ele.getbeizhu() <<"..............................."<<j <<std::endl;
++j;
}
}
}
else
{
cout <<f_red<< "今天日程" <<reset<< endl;
cout << "个人:" << endl;
int j = 1;
for (auto ele : year_vec[now_year - 2023].get_month_arr()[now_month - 1].get_day_vec()[now_day - 1].get_schedule_vec())
{
if (ele.gettype() == "person")
{
std::cout << ele.getevent() << "~" <<
ele.gettime() << "~" << ele.getsite() << "~" << ele.getbeizhu() <<"..............................."<<j <<std::endl;
++j;
}
}
cout << "团队:" << endl;
j = 1;
for (auto ele : year_vec[now_year - 2023].get_month_arr()[now_month - 1].get_day_vec()[now_day - 1].get_schedule_vec())
{
if (ele.gettype() == "team")
{
std::cout << ele.getevent() << "~" <<
ele.gettime() << "~" << ele.getsite() << "~" << ele.getbeizhu() <<"..............................."<<j <<std::endl;
++j;
}
}
}
//std::cout << "***************" << endl;
auto n_year = nextDay(now_year,now_month,now_day)[0];
auto n_month = nextDay(now_year,now_month,now_day)[1];
auto n_day = nextDay(now_year,now_month,now_day)[2];
if (year_vec[n_year - 2023].get_month_arr()[n_month - 1].get_day_vec()[n_day - 1].get_schedule_number() == 0)
{
cout <<f_green<< "明天无日程" <<reset<< endl;
}
else if(year_vec[n_year - 2023].get_month_arr()[n_month - 1].get_day_vec()[n_day - 1].get_personal_schedule_number()!=0&& year_vec[n_year - 2023].get_month_arr()[n_month - 1].get_day_vec()[n_day - 1].get_team_schedule_number()==0)
{
cout <<f_red<< "明天日程" <<reset<< endl;
cout << "个人:" << endl;
int j = 1;
for (auto ele : year_vec[n_year - 2023].get_month_arr()[n_month - 1].get_day_vec()[n_day - 1].get_schedule_vec())
{
if (ele.gettype() == "person")
{
std::cout << ele.getevent() << "~" <<
ele.gettime() << "~" << ele.getsite() << "~" << ele.getbeizhu() <<"..............................."<<j <<std::endl;
++j;
}
}
/*cout << "无团队" << endl;*/
}
else if (year_vec[n_year - 2023].get_month_arr()[n_month - 1].get_day_vec()[n_day - 1].get_personal_schedule_number() == 0 && year_vec[n_year - 2023].get_month_arr()[n_month - 1].get_day_vec()[n_day - 1].get_team_schedule_number() != 0)
{
cout <<f_red<< "明天日程" <<reset<< endl;
/* cout << "无个人" << endl;*/
cout << "团队:" << endl;
int j = 1;
for (auto ele : year_vec[n_year - 2023].get_month_arr()[n_month - 1].get_day_vec()[n_day - 1].get_schedule_vec())
{
if (ele.gettype() == "team")
{
std::cout << ele.getevent() << "~" <<
ele.gettime() << "~" << ele.getsite() << "~" << ele.getbeizhu() <<"..............................."<<j <<std::endl;
++j;
}
}
}
else
{
cout <<f_red<< "明天日程" <<reset<< endl;
cout << "个人:" << endl;
int j = 1;
for (auto ele : year_vec[n_year - 2023].get_month_arr()[n_month - 1].get_day_vec()[n_day - 1].get_schedule_vec())
{
if (ele.gettype() == "person")
{
std::cout << ele.getevent() << "~" <<
ele.gettime() << "~" << ele.getsite() << "~" << ele.getbeizhu() <<"..............................."<<j <<std::endl;
++j;
}
}
cout << "团队:" << endl;
j = 1;
for (auto ele : year_vec[n_year - 2023].get_month_arr()[n_month - 1].get_day_vec()[n_day - 1].get_schedule_vec())
{
if (ele.gettype() == "team")
{
std::cout << ele.getevent() << "~" <<
ele.gettime() << "~" << ele.getsite() << "~" << ele.getbeizhu() <<"..............................."<<j <<std::endl;
++j;
}
}
}
//std::cout << "***************" << endl;
auto nn_year = nextDay(n_year, n_month, n_day)[0];
auto nn_month = nextDay(n_year, n_month, n_day)[1];
auto nn_day = nextDay(n_year, n_month, n_day)[2];
if (year_vec[nn_year - 2023].get_month_arr()[nn_month - 1].get_day_vec()[nn_day - 1].get_schedule_number() == 0)
{
cout<<f_green << "后天无日程" <<reset<< endl;
}
else if (year_vec[nn_year - 2023].get_month_arr()[nn_month - 1].get_day_vec()[nn_day - 1].get_personal_schedule_number() != 0 && year_vec[nn_year - 2023].get_month_arr()[nn_month - 1].get_day_vec()[nn_day - 1].get_team_schedule_number() == 0)
{
cout <<f_red<< "后天日程"<<reset << endl;
cout << "个人:" << endl;
int j = 1;
for (auto ele : year_vec[nn_year - 2023].get_month_arr()[nn_month - 1].get_day_vec()[nn_day - 1].get_schedule_vec())
{
if (ele.gettype() == "person")
{
std::cout << ele.getevent() << "~" <<
ele.gettime() << "~" << ele.getsite() << "~" << ele.getbeizhu() <<"..............................."<<j <<std::endl;
++j;
}
}
/*cout << "无团队" << endl;*/
}
else if (year_vec[nn_year - 2023].get_month_arr()[nn_month - 1].get_day_vec()[nn_day - 1].get_personal_schedule_number() == 0 && year_vec[nn_year - 2023].get_month_arr()[nn_month - 1].get_day_vec()[nn_day - 1].get_team_schedule_number() != 0)
{
cout << f_red<<"后天日程" <<reset<< endl;
/*cout << "无个人" << endl;*/
cout << "团队:" << endl;
int j = 1;
for (auto ele : year_vec[nn_year - 2023].get_month_arr()[nn_month - 1].get_day_vec()[nn_day - 1].get_schedule_vec())
{
if (ele.gettype() == "team")
{
std::cout << ele.getevent() << "~" <<
ele.gettime() << "~" << ele.getsite() << "~" << ele.getbeizhu() <<"..............................."<<j <<std::endl;
++j;
}
}
}
else
{
cout <<f_red<< "后天日程" <<reset<< endl;
cout << "个人:" << endl;
int j = 1;
for (auto ele : year_vec[nn_year - 2023].get_month_arr()[nn_month - 1].get_day_vec()[nn_day - 1].get_schedule_vec())
{
if (ele.gettype() == "person")
{
std::cout << ele.getevent() << "~" <<
ele.gettime() << "~" << ele.getsite() << "~" << ele.getbeizhu() <<"..............................."<<j <<std::endl;
++j;
}
}
cout << "团队:" << endl;
j = 1;
for (auto ele : year_vec[nn_year - 2023].get_month_arr()[nn_month - 1].get_day_vec()[nn_day - 1].get_schedule_vec())
{
if (ele.gettype() == "team")
{
std::cout << ele.getevent() << "~" <<
ele.gettime() << "~" << ele.getsite() << "~" << ele.getbeizhu() <<"..............................."<<j <<std::endl;
++j;
}
}
}
}
const std::vector<year> get_year_vec()//不能返回引用
{
std::vector<year>year_vec;
for(int i = 1;i <= 50;i++)
{
year_vec.emplace_back(year(2023 + i - 1));
}
return year_vec;
}
string user_func(user u)
{
year_vec=get_year_vec();
shared_riqi_vec.clear();
riqi_vec.clear();
system("cls");
//首次使用创建文件,后面已经创建了就别再截断文件
ofstream o_shared_file;
o_shared_file.open("G:/我的云端硬盘/Multi-function_calendar_data/shared_data",ofstream::app);
if (!o_shared_file.is_open())
{
std::cout << f_red << "操作失败:无法打开文件!" << reset << endl;
exit(8);
}
o_shared_file.close();
std::ofstream ofile;
ofile.open("G:/我的云端硬盘/Multi-function_calendar_data/"+u.get_user_name(),ofstream::app);
if(!ofile.is_open())
{
std::cout << f_red << "操作失败:无法打开文件!" << reset << endl;
exit(9);
}
ofile.close();
//读取文件数据
ifstream i_shared_file;
i_shared_file.open("G:/我的云端硬盘/Multi-function_calendar_data/shared_data");
if (!i_shared_file.is_open())
{
std::cout << f_red << "操作失败:无法打开文件!" << reset << endl;
exit(-1);
}
unsigned int year_number = 0, month_number = 0, day_number = 0, personal_schedule_number = 0, team_schedule_number = 0;
string type, event, time, site,beizhu;
while (i_shared_file >> year_number >> month_number >> day_number >> team_schedule_number)
{
shared_riqi_vec.emplace_back(year_number, month_number, day_number);
i_shared_file.ignore();
for (unsigned int i = 1; i <= team_schedule_number; ++i)
{
getline(i_shared_file, type);
getline(i_shared_file, event);
getline(i_shared_file, time);
getline(i_shared_file, site);
getline(i_shared_file, beizhu);
year_vec[year_number - 2023].get_month_arr()[month_number - 1].get_day_vec()[day_number - 1].get_schedule_vec().emplace_back(schedule(type,event, time, site,beizhu));
}
}
i_shared_file.close();
std::ifstream ifile;
ifile.open("G:/我的云端硬盘/Multi-function_calendar_data/"+u.get_user_name());
if(!ifile.is_open())
{
std::cout << f_red << "操作失败:无法打开文件!" << reset << endl;
exit(-2);
}
unsigned int last_message_number=0;
ifile >> last_message_number;
ifile.ignore();
message_number = dialogue_vec.size();
if(last_message_number == message_number)
{
wuxinxiaoxi = true;
}
else
{
wuxinxiaoxi = false;
}
while(ifile >> year_number >> month_number >> day_number >> personal_schedule_number)
{
riqi_vec.emplace_back(year_number,month_number,day_number);
ifile.ignore();
for(unsigned int i = 1;i <= personal_schedule_number;++i)
{
getline(ifile, type);
getline(ifile,event);
getline(ifile,time);
getline(ifile,site);
getline(ifile, beizhu);
year_vec[year_number - 2023].get_month_arr()[month_number - 1].get_day_vec()[day_number - 1].get_schedule_vec().emplace_back(schedule(type,event,time,site,beizhu));
}
}
ifile.close();
string s=main_interface(u);
o_shared_file.open("G:/我的云端硬盘/Multi-function_calendar_data/shared_data", ofstream::trunc);
if (!o_shared_file.is_open())
{
std::cout << f_red << "操作失败:无法打开文件!" << reset << endl;
exit(-3);
}
sort(shared_riqi_vec.begin(), shared_riqi_vec.end());
auto iter2 = unique(shared_riqi_vec.begin(), shared_riqi_vec.end());
shared_riqi_vec.erase(iter2, shared_riqi_vec.end());
for (const auto& ele : shared_riqi_vec)
{
o_shared_file << ele.get_year_number() << " " << ele.get_month_number() << " " << ele.get_day_number() << " " << year_vec[ele.get_year_number() - 2023].get_month_arr()[ele.get_month_number() - 1].get_day_vec()[ele.get_day_number() - 1].get_team_schedule_number() << std::endl;
for (const auto& ele2 : year_vec[ele.get_year_number() - 2023].get_month_arr()[ele.get_month_number() - 1].get_day_vec()[ele.get_day_number() - 1].get_schedule_vec())
{
if (ele2.gettype() == "person")
{
continue;
}
o_shared_file << ele2.gettype() << endl;
o_shared_file << ele2.getevent() << endl;
o_shared_file << ele2.gettime() << endl;
o_shared_file << ele2.getsite() << endl;
o_shared_file << ele2.getbeizhu() << endl;
}
}
o_shared_file.close();
ofile.open("G:/我的云端硬盘/Multi-function_calendar_data/"+u.get_user_name(), ofstream::trunc);
if(!ofile.is_open())
{
std::cout << f_red << "操作失败:无法打开文件!" << reset << endl;
exit(-4);
}
ofile << dialogue_vec.size()<<endl;
sort(riqi_vec.begin(),riqi_vec.end());
auto iter = unique(riqi_vec.begin(),riqi_vec.end());
riqi_vec.erase(iter,riqi_vec.end());
for(const auto & ele : riqi_vec)
{
ofile << ele.get_year_number() << " " << ele.get_month_number() << " " << ele.get_day_number() << " " << year_vec[ele.get_year_number() - 2023].get_month_arr()[ele.get_month_number() - 1].get_day_vec()[ele.get_day_number() - 1].get_personal_schedule_number() << std::endl;
for(const auto & ele2 : year_vec[ele.get_year_number() - 2023].get_month_arr()[ele.get_month_number() - 1].get_day_vec()[ele.get_day_number() - 1].get_schedule_vec())
{
if (ele2.gettype() == "team")
{
continue;
}
ofile << ele2.gettype() << endl;
ofile << ele2.getevent() << endl;
ofile << ele2.gettime() << endl;
ofile << ele2.getsite() << endl;
ofile << ele2.getbeizhu() << endl;
}
}
ofile.close();
return s;
}
//
//string get_wps_path()
//{
// string s = "C:用户";
// for (const auto& ele : filesystem::directory_iterator(s))
// {
// if (ele.is_directory())
// {
// if (filesystem::exists(ele.path().string() + "/WPS云盘/共享文件夹"))
// {
// return ele.path().string() + "/WPS云盘/共享文件夹";
// }
// }
// }
// cout << f_red << "操作失败:wps云盘未保存在默认路径下!" << reset << endl;
// exit(4);
//}
void list_chengyuan(vector<user>&user_vec)
{
unsigned int guanliyuan_number = 0;
unsigned int qunchengyuan_number = 0;
for(auto& ele : user_vec)
{
if(ele.get_user_shenfen() == "管理员")
{
++guanliyuan_number;
}
}
for(auto& ele : user_vec)
{
if(ele.get_user_shenfen() == "群成员")
{
++qunchengyuan_number;
}
}
cout << "群主(1/" << user_vec.size()<<")" << endl;
auto iter=find_if(user_vec.begin(), user_vec.end(), [](const user& u)->bool{return u.get_user_shenfen() == "群主"; });
cout << iter->get_user_name()<<endl;
cout << "管理员(" <<guanliyuan_number<<"/"<<user_vec.size()<<")" << endl;
for(auto& ele : user_vec)
{
if(ele.get_user_shenfen() == "管理员")
{
cout << ele.get_user_name() << endl;
}
}
cout << "群成员(" << qunchengyuan_number << "/" << user_vec.size() << ")" << endl;
for(auto& ele : user_vec)
{
if(ele.get_user_shenfen() == "群成员")
{
cout << ele.get_user_name() << endl;
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。