#include <iostream>
using namespace std;
const int strsize=30;
const int BOPSIZE=5;
void showmenu()
{
cout<<"Benevolent Order of Programmers Report\n"
"a. display by name b. display by title\n"
"c. display by bopname d. display by preference\n"
"q. quit\n";
}
struct bop
{
char fullname[strsize];
char title[strsize];
char bopname[strsize];
int preference;
};
int main()
{
showmenu();
char ch;
int i;
bop newbop[BOPSIZE]=
{
{"Wimp Macho","Teahcer","WWW",0},
{"Raki Rhodes","Junior Programmer","RRR",1},
{"Celia Laiter","Star","MIPS",2},
{"Hoppy Hipman","Analyst Trainee","HHH",1},
{"Pat Hand","Doctor","LOOPY",2}
};
cout<<"Enter your choice: ";
while(cin>>ch && ch!='q')
{
switch(ch)
{
case 'a':
for(i=0;i<BOPSIZE;i++)
cout<<newbop[i].fullname<<endl;
break;
case 'b':
for(i=0;i<BOPSIZE;i++)
cout<<newbop[i].title<<endl;
break;
case 'c':
for(i=0;i<BOPSIZE;i++)
cout<<newbop[i].bopname<<endl;
break;
case 'd':
for(i=0;i<BOPSIZE;i++)
{
if(0==newbop[i].preference)
cout<<newbop[i].fullname<<endl;
else if(1==newbop[i].preference)
cout<<newbop[i].title<<endl;
else if(2==newbop[i].preference)
cout<<newbop[i].bopname<<endl;
}
break;
//case 'q':cout<<"Bye!\n";
}
cout<<"Next choice: ";
}
cout<<"Bye!\n";
system("pause");
return 0;
}

编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习4的更多相关文章

  1. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习9

    #include <iostream> #include <fstream> #include <cstdlib> #include <string> ...

  2. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习8

    #include <iostream> #include <fstream> #include <cstdlib> const int SIZE=20; using ...

  3. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习7

    #include <iostream> #include <string> #include <cctype> using namespace std; int m ...

  4. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习6

    #include <iostream> #include <string> using namespace std; const int MSIZE=100; struct j ...

  5. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习5

    #include <iostream> using namespace std; const double N1=35000; const int N2=15000; const int ...

  6. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习3

    #include <iostream> using namespace std; void showmenu(void) { cout<<"Please enter ...

  7. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习2

    #include <iostream> #include <cctype> using namespace std; const int MAXSIZE=10; int mai ...

  8. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习1

    #include <iostream>#include <cctype>using namespace std;int main(){ char ch; while((ch=c ...

  9. 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第5章编程练习9

    #include <iostream>using namespace std;int main(){ int num; cout<<"Enter number of ...

随机推荐

  1. 解析中国天气网页面获取七日天气 (Java, Python)

    说明 解析中国天气网的页面,获取七日天气. 使用 htmlparser .这是它的 API 文档. 代码 SevenDayWeather.java import java.io.BufferedRea ...

  2. JAVA基础---入门

    JDK的安装和环境变量的配置: 在Oralce官网下载好符合自己电脑配置的JDK后开始配置环境变量. 找到下载好的JDK的位置,复制,然后在环境变量里创建“JAVA_HOME”,粘贴:在path里用“ ...

  3. jetty切换tomcat中文乱码

    项目中文在jetty下正常,换tomcat下出现乱码. 问题是web.xml中的encodingFilter不是第一个,要设置为第一个 <filter> <filter-name&g ...

  4. php nginx 负载均衡简单配置过程

    负载均衡 负载均衡是我们大流量网站要做的一个东西,下面我来给大家介绍在Nginx服务器上进行负载均衡配置方法,希望对有需要的同学有所帮助哦. 简单了解一下什么是负载均衡,单从字面上的意思来理解就可以解 ...

  5. 基于XML搭建SpringMVC项目

    *如果你需要将应用部署到不支持Servlet3.0容器中 或者 你只是对web.xml情有独钟,那我们只能按照传统的方式,通过web.xml来配置SpringMVC. *搭建SpringMVC需要在w ...

  6. 关于typecho0.9代码高亮与数学公式支持

    闲来无事,搭了一个博客,记录一下自己的学习生活,博客模板取自原来typecho官方博客,稍加修改,改了一下涂装,不得不说插件支持有一些问题,目前大多数插件已经同步更新到typecho1.0版本,新插件 ...

  7. iOS cocoapods 速度过慢问题

    这个问题真的困扰了很久,虽然我也开了shadowsocks,但是我不知道git命令默认是不走shadowsocks的,所以速度慢的很. 今天拜读了 https://blog.csdn.net/wuqu ...

  8. VUE项目快速构建

    IDE  :VScode 1.新建项目文件夹 ctrl+~   调出命令板,/IDE找到当前文件夹右键 点击‘在命令提示符中打开’ 安装 node:官网(https://nodejs.org/en/d ...

  9. https请求之绕过证书安全校验工具类(原)

    package com.isoftstone.core.util; import java.io.BufferedReader; import java.io.ByteArrayOutputStrea ...

  10. element-ui对话框组件Dialog在回调事件opened获取组件滚动条scrollTop的问题

    今天使用element中的Dialog组件时发现一个问题:当Dialog内容过多时会出现滚动条,而当你滚动到一定位置后关闭Dialog,然后再次打开时滚动条仍然保持在上一次关闭前的位置而没有回到顶部. ...