编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习4
#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的更多相关文章
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习9
#include <iostream> #include <fstream> #include <cstdlib> #include <string> ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习8
#include <iostream> #include <fstream> #include <cstdlib> const int SIZE=20; using ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习7
#include <iostream> #include <string> #include <cctype> using namespace std; int m ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习6
#include <iostream> #include <string> using namespace std; const int MSIZE=100; struct j ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习5
#include <iostream> using namespace std; const double N1=35000; const int N2=15000; const int ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习3
#include <iostream> using namespace std; void showmenu(void) { cout<<"Please enter ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习2
#include <iostream> #include <cctype> using namespace std; const int MAXSIZE=10; int mai ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第6章编程练习1
#include <iostream>#include <cctype>using namespace std;int main(){ char ch; while((ch=c ...
- 编程菜鸟的日记-初学尝试编程-C++ Primer Plus 第5章编程练习9
#include <iostream>using namespace std;int main(){ int num; cout<<"Enter number of ...
随机推荐
- istio环境搭建for macbook
首先需要搭建docker+k8s环境,如何搭建这里就不再赘述,可以自行搜索. 打开命令行,运行命令: curl -L https://git.io/getLatestIstio | ISTIO_VER ...
- IDEA中 GIT与SVN版本控制插件的切换
https://www.cnblogs.com/yccmelody/p/7794220.html
- C# 创建Web项目时 可以选择的类型在不同VS版本下的对比
上面这个界面应该是 vs2010的 一. VS2012 .VS2013 其实每个模板的意思,在右边已经显示出来了.Empty,就是一个空的模板,创建后里面除了一个web.config外什么都没有:We ...
- Bootstrap常用表单布局
参考链接: https://blog.csdn.net/shuai_wy/article/details/78978023
- 备考2019年6月份PMP考试-分享一些(备考)考试心得
I'm iron man,纪念离去的钢铁侠(复联4) 话说任何一个写程序的人都不可能干一辈子(有些人例外),大部分都是要转行的. 技术转管理是一条路,技术转创业是一条路,技术干销售是一条路,技术转售前 ...
- 【转】ContextLoaderListener和DispatcherServlet加载内容的区别
一.ContextLoaderListener加载内容 二.DispatcherServlet加载内容 ContextLoaderListener和DispatcherServlet都会在Web容器启 ...
- GitLab实战操作指南
一.Git原理 1.Git是什么? Git是目前世界上最先进的分布式版本控制系统(没有之一). 2.Git有什么特点? 简单来说就是:高端大气上档次! 3.GIt与SVN区别 SVN管理: 属于集中式 ...
- Python env使用(virtualenv)
前言 Python 的 virualenv 模块闻名已久,乘着有点时间,学习一下 变更记录 # 19.3.26 创建文章 # 19.3.27 完善文章 正文 安装 pip install virt ...
- node 创建
下载 node : 注意选项 ADD PATH 配置环境变量 node -v npm -v 检查创建一个服务器 : //创建一个服务器 127.0.0.1:8888 var http = requir ...
- 解决vuecli3.0构建的vue2.0项目在IE9可能出现的兼容性问题
1,unit8Array等未定义问题 解决办法 <1>npm install @babel/polyfill <2>分别在main.js和vuex的主文件 import '@b ...