#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. P2P互联网金融企业的四大转型方向

    1.按照国标做成百分百的信息中介平台.这个定位太低,无利可图,如果政策导向真按着这个路径走,未来可能只剩下不到50家平台; 2.转型成为带“民营银行”属性的平台.这还得国家网开一面,学习英国模式,允许 ...

  2. MySQL数据库 Too many connections

    出现这种错误明显就是 mysql_connect 之后忘记 mysql_close:当大量的connect之后,就会出现Too many connections的错误,mysql默认的连接为100个, ...

  3. js下载后台返回的docx(返回格式:文档流)文件

    原文地址: https://www.jianshu.com/p/a81c68c15fbd PS需要指定responseType类型,不然文件内容会乱码哦 咦?文件名乱码?需要手动设置文件名哦↓ 呀,文 ...

  4. Python自动化中的元素定位xpath(二)

    1.Xpath元素定位 1)ele = b.find_element_by_xpath(‘/html/body/from/input[1]’) 2)Ele = b.find_element_by_xp ...

  5. 第十七节,OpenCV(学习六)图像轮廓检测

    1.检测轮廓 轮廓检测是图像处理中经常用到的,OpenCV-Python接口中使用cv2.findContours()函数查找检测物体的轮廓. cv2.findContours(image, mode ...

  6. centos7.6设置sftp服务

    sftp是Secure File Transfer Protocol的缩写,安全文件传送协议. CentOS自带 SSH 服务,直接配置即可 1. 查看ssh版本 sftp是基于ssh协议的,首先查看 ...

  7. Deep Mutual Learning

    论文地址: https://arxiv.org/abs/1706.00384 论文简介 该论文探讨了一种与模型蒸馏(model distillation)相关却不同的模型---即相互学习(mutual ...

  8. sql 常见错误总结

    1.根据一张表更新另一张表的数据. . 写法轻松,更新效率高: update table1 set field1=table2.field1, field2=table2.field2 from ta ...

  9. IDEA内的SpringBoot插件安装与SpringBoot项目生成地址

    最新安装idea,在新建项目时没有spring initializr选项,也没有spring assistant选项.因此需要安装相应插件 在菜单栏 file>>settings>& ...

  10. 初识C语言 (四)

    分支结构 if语句 C语言中的分支结构语句中的if条件语句,简单if语句的基本结构如下: 其语义是:如果表达式的值为真,则执行其后的语句,否则不执行该语句. 其过程可表示为下图 实例: if(resu ...