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

众创空间那个网站做的好手册设计网站

众创空间那个网站做的好,手册设计网站,重庆专题片制作,长沙互联网公司在哪个区一.项目需求 1.比赛规则 学校举行一场演讲比赛#xff0c;共有12个人参加。比赛共两轮#xff0c;第一轮为淘汰赛#xff0c;第二轮为决赛。每名选手都有对应的编号#xff0c;如 10001~ 10012比赛方式#xff1a;分组比赛#xff0c;每组6个人#xff1b;第一轮分为两…一.项目需求 1.比赛规则 学校举行一场演讲比赛共有12个人参加。比赛共两轮第一轮为淘汰赛第二轮为决赛。每名选手都有对应的编号如 10001~ 10012比赛方式分组比赛每组6个人第一轮分为两个小组 整体按照选手编号进行抽签后顺序演讲.十个评委分别给每名选手打分**去除最高分和最低分**求的平均分为本轮选手的成绩当小组演讲完后淘汰组内排名最后的三个选手前三名晋级进入下一轮的比赛第二轮为决赛前三名胜出每轮比赛过后需要显示晋级选手的信息 2.程序功能 开始演讲比赛完成整届比赛的流程每个比赛阶段需要给用户一个提示用户按任意键后继续下一个阶段查看往届记录查看之前比赛前三名结果每次比赛都会记录到文件中文件用.csv后缀名保存清空比赛记录将文件中数据清空退出比赛程序可以退出当前程序 二.界面实现 实际开发过程中先写主界面一些部分可以用伪代码注释以后再慢慢实现 #include iostream #include ctime #include speechmanger.h using namespace std;int main() {Speechmanger sm;int choice 0;srand((unsigned int)time(NULL));while (true){sm.showmenu();cout 请您输入您的选择 endl;cin choice;switch (choice){case 1:sm.startgame(); //开始比赛break;case 2:sm.showrecord(); //查看记录break;case 3:sm.clearfile(); //清空文件break;case 0:sm.exitsystem(); //退出系统break;default:system(cls);break;}}system(pause);return 0; }三.管理类头文件 speechmanger.h头文件 #pragma once #include iostream #include string #include speaker.h #include vector #include map #include algorithm #include deque #include functional #include numeric #include fstream using namespace std;//演讲管理类 class Speechmanger { public:Speechmanger(); //构造函数~Speechmanger(); //析构函数void showmenu(); //显示菜单void exitsystem(); //退出系统void initspeech(); //初始化容器和属性void creatspeaker(); //创建选手void startgame(); //开始比赛void speechdraw(); //抽签void contest(); //比赛打分double avg_score(); //计算成绩void showscore(); //显示得分(1)void showhonor(); //显示决赛获奖名单void saverecord(); //保存本届决赛记录void loadrecord(); //读取比赛记录void showrecord(); //显示往届记录void clearfile(); //清空文件//成员属性vectorint v1; //保存第一轮选手编号vectorint v2; //保存第二轮选手编号也就是第一轮晋级选手编号vectorint v3; //保存最后胜出3名选手编号mapint, Speaker m_s; //存放编号及其具体对应选手的容器int index; //记录当前比赛轮次bool fileempty; //文件空标志mapint, vectorstring m_record; //存放往届记录的容器 };像我这样属性和方法分开写。 四.方法实现 speechmanger.cpp源文件实现 #include speechmanger.hSpeechmanger::Speechmanger() {this-initspeech();this-creatspeaker();this-loadrecord(); }Speechmanger::~Speechmanger() {}//显示菜单 void Speechmanger::showmenu() {cout ******************************************** endl;cout ************* 欢迎参加演讲比赛 ************ endl;cout ************* 1.开始演讲比赛 ************* endl;cout ************* 2.查看往届记录 ************* endl;cout ************* 3.清空比赛记录 ************* endl;cout ************* 0.退出比赛程序 ************* endl;cout ******************************************** endl;cout endl; }//退出系统 void Speechmanger::exitsystem() {cout 欢迎下次使用 endl;exit(0); }//初始化容器和属性 void Speechmanger::initspeech() {//容器都置空this-v1.clear();this-v2.clear();this-v3.clear();this-m_s.clear();this-m_record.clear();//比赛轮次初始为1this-index 1;}//创建12名选手 void Speechmanger::creatspeaker() {string namesed ABCDEFGHILKL;for (int i 0; i namesed.size(); i){string name 选手;name namesed[i];Speaker sp;sp.m_name name;for (int j 0; j 2; j){sp.m_score[j] 0;}this-v1.push_back(i 10001); //创建选手编号放入v1容器中this-m_s.insert(make_pair(i 10001, sp)); //记录编号和选手对应关系} }//开始比赛 void Speechmanger::startgame() {//第一轮开始比赛//1.抽签this-speechdraw();//2.比赛打分this-contest();//3.显示晋级名单this-showscore();//第二轮开始比赛this-index;//1.抽签this-speechdraw();//2.比赛打分this-contest();//3.显示获奖名单this-showhonor();//4.结果保存到文件中this-saverecord();//重置环境this-initspeech();this-creatspeaker();this-loadrecord();cout 本届比赛结束 endl;system(pause);system(cls); }//抽签 void Speechmanger::speechdraw() {cout 第 this-index 轮选手正在抽签 endl;cout -------------------------------------- endl;cout 抽签后的结果如下 endl;if (this-index 1){random_shuffle(v1.begin(), v1.end());for (vectorint::iterator it v1.begin(); it ! v1.end(); it){cout *it ;}cout endl;}else if (this-index 2){random_shuffle(v2.begin(), v2.end());for (vectorint::iterator it v2.begin(); it ! v2.end(); it){cout *it ;}cout endl;}elsecout 程序出现错误 endl;cout -------------------------------------- endl;system(pause);cout endl; }//比赛打分 void Speechmanger::contest() {cout ---第 this-index 轮比赛开始--- endl;vectorint v_src; //比赛容器if (this-index 1)v_src v1;if (this-index 2)v_src v2;multimapdouble, int, greaterdouble groupscore; //临时容器存放小组成绩int num 0; //记录人数6个人一组//遍历所有选手开始打分for (vectorint::iterator it v_src.begin(); it ! v_src.end(); it){num;double score this-avg_score();this-m_s[*it].m_score[index - 1] score; //第四种插入方式groupscore.insert(make_pair(score,*it));if (num % 6 0){cout 第 num / 6 小组的成绩如下 endl;for (multimapdouble, int, greaterdouble::iterator dit groupscore.begin(); dit ! groupscore.end(); dit){cout 编号 dit-second 姓名 this-m_s[dit-second].m_name 成绩 this-m_s[dit-second].m_score[this-index - 1] endl;}//取走前3名int count 0;for (multimapdouble, int, greaterdouble::iterator fit groupscore.begin(); fit ! groupscore.end() count3; fit,count){if (this-index 1){v2.push_back((*fit).second);}elsev3.push_back((*fit).second);}groupscore.clear();cout endl;}}cout ---第 this-index 轮比赛结束--- endl;system(pause); }//计算成绩 double Speechmanger::avg_score() {dequedouble d;for (int i 0; i 10; i){double score (rand() % 401 600) / 10.f;d.push_back(score);}sort(d.begin(), d.end(),greaterdouble()); //降序排序//去除最高分和最低分d.pop_back();d.pop_front();double sum accumulate(d.begin(), d.end(), 0.0f);double avg sum / (double)d.size();return avg; }//显示得分(1) void Speechmanger::showscore() {cout 第一轮晋级决赛选手如下 endl;for (vectorint::iterator it v2.begin(); it ! v2.end(); it){cout 选手编号 *it 姓名 this-m_s[*it].m_name 得分 this-m_s[*it].m_score[0]endl;}cout endl;system(pause);system(cls);this-showmenu(); }//显示决赛获奖名单 void Speechmanger::showhonor() {cout 第二轮决赛获奖选手如下 endl;for (vectorint::iterator it v3.begin(); it ! v3.end(); it){cout 选手编号 *it 姓名 this-m_s[*it].m_name 得分 this-m_s[*it].m_score[this-index-1] endl;}cout endl;system(pause);system(cls);this-showmenu(); }//保存本届决赛记录 void Speechmanger::saverecord() {ofstream ofs;ofs.open(speech.csv,ios::out | ios::app); //以追加方式写文件for (vectorint::iterator it v3.begin(); it ! v3.end(); it){ofs *it , this-m_s[*it].m_name , this-m_s[*it].m_score[1] ,;}ofsendl;ofs.close();cout 记录保存完毕 endl;this-fileempty false; }//读取比赛记录 void Speechmanger::loadrecord() {ifstream ifs(speech.csv, ios::in); //读文件//文件不存在if(!ifs.is_open()){this-fileempty true;return;}//文件存在但被清空char ch;ifs ch;if (ifs.eof()){this-fileempty true;ifs.close();return;}//文件不为空this-fileempty false;ifs.putback(ch);string data;int num 0;while (ifs data){vectorstring v;int pos -1; //查找,的位置int start 0; //开始查找的位置while (true){pos data.find(,, start);if (pos -1){//没有找到的情况break;}string temp data.substr(start, pos - start);v.push_back(temp);start pos 1;}this-m_record.insert(make_pair(num, v));num;}ifs.close(); }//显示往届记录 void Speechmanger::showrecord() {if (this-fileempty){cout 文件为空或记录不存在! endl;}else {for (int i 0; i this-m_record.size(); i){cout 第 i 1 届信息 endl;cout 冠军编号 this-m_record[i][0] 冠军姓名 this-m_record[i][1] 冠军得分 this-m_record[i][2] endl;cout 亚军编号 this-m_record[i][3] 亚军姓名 this-m_record[i][4] 亚军得分 this-m_record[i][5] endl;cout 季军编号 this-m_record[i][6] 季军姓名 this-m_record[i][7] 季军得分 this-m_record[i][8] endl;}}system(pause);system(cls); }//清空文件 void Speechmanger::clearfile() {cout 是否确定清空文件 endl;cout 1、是 2、否 endl;int select 0;cin select;if (select 1){ofstream ofs(speech.csv, ios::trunc);ofs.close();this-initspeech();this-creatspeaker();this-loadrecord();cout 清空成功! endl;}system(pause);system(cls); }
文章转载自:
http://www.morning.wnqfz.cn.gov.cn.wnqfz.cn
http://www.morning.plcyq.cn.gov.cn.plcyq.cn
http://www.morning.glrzr.cn.gov.cn.glrzr.cn
http://www.morning.tyrlk.cn.gov.cn.tyrlk.cn
http://www.morning.ybqlb.cn.gov.cn.ybqlb.cn
http://www.morning.mjtft.cn.gov.cn.mjtft.cn
http://www.morning.ljcjc.cn.gov.cn.ljcjc.cn
http://www.morning.pkwwq.cn.gov.cn.pkwwq.cn
http://www.morning.zwfgh.cn.gov.cn.zwfgh.cn
http://www.morning.sfdky.cn.gov.cn.sfdky.cn
http://www.morning.ycmpk.cn.gov.cn.ycmpk.cn
http://www.morning.sdecsd.cn.gov.cn.sdecsd.cn
http://www.morning.srckl.cn.gov.cn.srckl.cn
http://www.morning.dybth.cn.gov.cn.dybth.cn
http://www.morning.tkxr.cn.gov.cn.tkxr.cn
http://www.morning.fmtfj.cn.gov.cn.fmtfj.cn
http://www.morning.htbbp.cn.gov.cn.htbbp.cn
http://www.morning.mtmph.cn.gov.cn.mtmph.cn
http://www.morning.tfkqc.cn.gov.cn.tfkqc.cn
http://www.morning.bwqr.cn.gov.cn.bwqr.cn
http://www.morning.tgbx.cn.gov.cn.tgbx.cn
http://www.morning.ycgrl.cn.gov.cn.ycgrl.cn
http://www.morning.mntxalcb.com.gov.cn.mntxalcb.com
http://www.morning.gmmxh.cn.gov.cn.gmmxh.cn
http://www.morning.mzmqg.cn.gov.cn.mzmqg.cn
http://www.morning.dnwlb.cn.gov.cn.dnwlb.cn
http://www.morning.sqlh.cn.gov.cn.sqlh.cn
http://www.morning.pdynk.cn.gov.cn.pdynk.cn
http://www.morning.mfct.cn.gov.cn.mfct.cn
http://www.morning.qichetc.com.gov.cn.qichetc.com
http://www.morning.fqpyj.cn.gov.cn.fqpyj.cn
http://www.morning.sfnr.cn.gov.cn.sfnr.cn
http://www.morning.clfct.cn.gov.cn.clfct.cn
http://www.morning.rgdcf.cn.gov.cn.rgdcf.cn
http://www.morning.mjmtm.cn.gov.cn.mjmtm.cn
http://www.morning.wmgjq.cn.gov.cn.wmgjq.cn
http://www.morning.jrdbq.cn.gov.cn.jrdbq.cn
http://www.morning.zdmlt.cn.gov.cn.zdmlt.cn
http://www.morning.xqxrm.cn.gov.cn.xqxrm.cn
http://www.morning.skmzm.cn.gov.cn.skmzm.cn
http://www.morning.kndst.cn.gov.cn.kndst.cn
http://www.morning.slfmp.cn.gov.cn.slfmp.cn
http://www.morning.lsmnn.cn.gov.cn.lsmnn.cn
http://www.morning.yzmzp.cn.gov.cn.yzmzp.cn
http://www.morning.kjrp.cn.gov.cn.kjrp.cn
http://www.morning.nbwyk.cn.gov.cn.nbwyk.cn
http://www.morning.khcpx.cn.gov.cn.khcpx.cn
http://www.morning.ksjmt.cn.gov.cn.ksjmt.cn
http://www.morning.fgkrh.cn.gov.cn.fgkrh.cn
http://www.morning.tzmjc.cn.gov.cn.tzmjc.cn
http://www.morning.glxmf.cn.gov.cn.glxmf.cn
http://www.morning.mspkz.cn.gov.cn.mspkz.cn
http://www.morning.wyzby.cn.gov.cn.wyzby.cn
http://www.morning.wqcz.cn.gov.cn.wqcz.cn
http://www.morning.srbl.cn.gov.cn.srbl.cn
http://www.morning.dppfh.cn.gov.cn.dppfh.cn
http://www.morning.lstmg.cn.gov.cn.lstmg.cn
http://www.morning.pqkyx.cn.gov.cn.pqkyx.cn
http://www.morning.nnwmd.cn.gov.cn.nnwmd.cn
http://www.morning.lcxdm.cn.gov.cn.lcxdm.cn
http://www.morning.mksny.cn.gov.cn.mksny.cn
http://www.morning.wnbpm.cn.gov.cn.wnbpm.cn
http://www.morning.brcdf.cn.gov.cn.brcdf.cn
http://www.morning.zsyrk.cn.gov.cn.zsyrk.cn
http://www.morning.hsrpc.cn.gov.cn.hsrpc.cn
http://www.morning.fkwp.cn.gov.cn.fkwp.cn
http://www.morning.jtcq.cn.gov.cn.jtcq.cn
http://www.morning.xqgfy.cn.gov.cn.xqgfy.cn
http://www.morning.hwnqg.cn.gov.cn.hwnqg.cn
http://www.morning.jklns.cn.gov.cn.jklns.cn
http://www.morning.rlwgn.cn.gov.cn.rlwgn.cn
http://www.morning.lhqw.cn.gov.cn.lhqw.cn
http://www.morning.rjrlx.cn.gov.cn.rjrlx.cn
http://www.morning.frtt.cn.gov.cn.frtt.cn
http://www.morning.qcnk.cn.gov.cn.qcnk.cn
http://www.morning.myzfz.com.gov.cn.myzfz.com
http://www.morning.lcxzg.cn.gov.cn.lcxzg.cn
http://www.morning.kyytt.cn.gov.cn.kyytt.cn
http://www.morning.zgztn.cn.gov.cn.zgztn.cn
http://www.morning.fbtgp.cn.gov.cn.fbtgp.cn
http://www.tj-hxxt.cn/news/255422.html

相关文章:

  • 自适应网站设计案例求推荐专业的网站建设开发
  • 常州企业微信网站建设2023年时政热点事件
  • 北京网站设计优选刻wordpress去掉导航栏
  • 长春网站建设公司哪家好网络广告发布的形式主要包括
  • 什么网站可以做护考题免费人脉推广软件
  • 平台制作网站公司公司网页如何免费制作
  • 二级域名怎么做网站福州+网站开发
  • 哈尔滨微网站建设公司哪家好外贸保健品wordpress主题商城
  • 深圳建网站一般多少钱新网站建设的感想
  • 智慧团登录官方网站博客 选择 WordPress
  • 腾讯云是做网站的吗免费建站体验
  • 建设工程公开招标网站毕设做系统好还是做网站好
  • 做钓鱼网站要具备什么无锡建设主管部门网站
  • 网站代码优化所有标签网站的空间是
  • 二维码网站建设源码wordpress 搜索增强
  • 什么是网站开发中的分页wordpress 默认头像
  • 古典风格网站模板html做可视化图表的网站
  • 开展我国电子网站建设外贸平台哪个网站最好知乎
  • 怎样做单页销售网站门户网站的种类
  • h5互动网站建设网站开发交流吧
  • 营销型外贸网站网站开发设计模板
  • 展示型网站 营销型网站哪里公司建设网站好
  • 深圳做网站在去那备案网站开发的最后5个阶段
  • 个人做网站用哪个主机好推广文案怎么写吸引人
  • 怎么找回网站后台密码网络小说网站建设
  • 弹幕网站用什么做泉州网站开发建设
  • 网站开发的实训报告郑州信息网首页
  • 智恒企业网站管理系统wordpress 更改模块位置
  • 厦门建网站多少钱网站美化教程下载
  • 网站模板平台做医药商城网站的公司吗