#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. data_summarize.pl data目录文本时长汇总脚本

    #!/usr/bin/env perl # Copyright 2018 Jarvan Wang if (@ARGV != 1) { #print STDERR "Usage: keywor ...

  2. JAVA的抽象类和接口

    抽象类 在面向对象的概念中,所有的对象都是通过类来描述的,但是反过来,并不是所有的类都是用来描述对象的,如果一个类中没有包含足够的信息来描绘一个具体的对象,这样的类就是抽象类. 抽象类除了不能实例化对 ...

  3. 「HNOI 2019」白兔之舞

    一道清真的数论题 LOJ #3058 Luogu P5293 题解 考虑$ n=1$的时候怎么做 设$ s$为转移的方案数 设答案多项式为$\sum\limits_{i=0}^L (sx)^i\bin ...

  4. further configuration avilable 不见了

    Dynameic Web Module的further configuration avilable  不见了 打开目录下的 org.eclipse.wst.common.project.facet. ...

  5. 一个简单的go语言爬虫

    package main import ( "bufio" "fmt" "golang.org/x/net/html/charset" &q ...

  6. CocoaLumberjack——带颜色的Log

    CocoaLumberjack可以带颜色Log,具体的好处嘛,谁用谁知道,:] 具体步骤如下: 1. 安装XcodeColors插件 下载地址:https://github.com/robbiehan ...

  7. Light OJ 1266 - Points in Rectangle

    题目 Link 就是查询矩形内有多少个点. 分析 二维树状数组维护就好了,. Code #include <bits/stdc++.h> const int maxn = 1000 + 1 ...

  8. JavaScript 变量声明:var、let、const

    1. 概述 1.1 说明 在ES5 声明变量的方法:var命令和function命令. 在ES6 声明变量的方法:var命令.function命令.let命令.const命令.import命令.cla ...

  9. 清晰讲解SQL语句中的内连接,通用于Mysql和Oracle,全是干货哦

    本文章目的:力求清晰明了讲解SQL语句的内连接的各种应用,没有深奥的理解! 前奏:这篇文章和下篇文章会将内连接和外连接讲解清楚SQL语句的多表查询常用的有以下几种:两表联合查询(1)内连接(2)外连接 ...

  10. docker bulid命令

    使用当前目录的 Dockerfile 创建镜像,标签为 runoob/ubuntu:v1. docker build -t runoob/ubuntu:v1 . 使用URL github.com/cr ...