#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. 通过DeviceIoControl读磁盘的方式读取独占文件内容

    前言 windows操作系统中常见的一个文件存储系统是NTFS.在这个文件系统中MFT是它的核心.             图一 MFT是一个数据结构,上图是它的结构,它主要用来存放每个文件和目录在磁 ...

  2. MySQL学习11 - MySQL创建用户和授权

    权限管理 权限管理 我们知道我们的最高权限管理者是root用户,它拥有着最高的权限操作.包括select.update.delete.update.grant等操作.那么一般情况在公司之后DBA工程师 ...

  3. MySQL保留字不能作为字段名使用

    在设计MySQL字段的时候,无意中使用InOut这个名称作为字段名称,结果前端提交后就是没有写入数据库!但后端没有任何提示,跟踪mySQL日志,也没有留下痕迹,反复查,不得其解. 后来实在没有办法情况 ...

  4. raw_input与input

    raw_input 不管用户输入的是什么,最后打印的类型都会是str字符串类型 input 会根据用户的输入变换成相应的类型,但是需要注意的是我们用户在输入字符或者字符串的时候,需要给他们加上双引号, ...

  5. Dubbo+Nacos做注册中心和配置中心

    项目结构 相关代码 EchoService public interface EchoService { String echo(String msg); } DefaultEchoService @ ...

  6. 论文学习笔记--无缺陷样本产品表面缺陷检测 A Surface Defect Detection Method Based on Positive Samples

    文章下载地址:A Surface Defect Detection Method Based on Positive Samples 第一部分  论文中文翻译 摘要:基于机器视觉的表面缺陷检测和分类可 ...

  7. Appnium-API-Session

    Session Create New Session Java: DesiredCapabilities desiredCapabilities = new DesiredCapabilities() ...

  8. 泛型约束new()的使用

    下面泛型约束代码,where字句后面有new()约束,T类型必须有公有的无参的构造函数. private T InternalCreate<T>() where T : IObjectWi ...

  9. 【DOS】Win7系统文件夹名太长无法删除问题的解决

    一个测试工具产生了几个坑爹文件夹名为n个“x” ,系统提示删除不掉. 网上百度,说什么压缩.写bat文件...统统没用. 猛地看到右击菜单中安装了git客户端工具,想试试看.在该文件夹目录下Git B ...

  10. Java软件工程的弹幕调试原则

    日期:2019.4.25 博客期:054 星期四 今天是把很久之前的那个相关程序——一维数组的最大和的子数组的求取信息,我们今天的任务就是把每一步的信息都要进行输出查看! 如下图: package p ...