#include<iostream>
const int strsize = 100;
using namespace std;
void show_real_name(struct bop message[],int n);
void show_job_ (struct bop message[],int n);
void show_bop_name(struct bop message[],int n);
void show_preference(struct bop message[],int n);
void enter_message(struct bop message[],int n);
struct bop
{
char fullname[strsize]; //real name
char [strsize]; //job titel
char bopname[strsize]; //secret BOP name
int preference; //0=fullname,1= ,2=bopname
};
int main()
{
int n;
struct bop message[5] =
{
{\"Wimp Macho\", \"Da shi xiong\", \"da sheng\", 1},
{\"Raki Rhodes\", \"Er shi xiong\", \"tian peng\", 1},
{\"Celia laiter\", \"Boss\", \"tang seng\", 1},
{\"Hoppy Hipman\", \"Pao tui\", \"wu jing\", 2},
{\"Pat Hand\", \"Xiao lao di\", \"bai long\", 0}
};
cout << \"Benevolent Order of Programmers Report\"<<endl;
cout << \"a)display by name \"<<\" \"<<\"b)display by \"<<endl
<<\"c)display by bopname \"<<\" \"<<\"d)display by preference\"<<endl
<<\"q)quit \"<<endl
<<\"Please enter q to quit\"<<endl;
char choice;
while(cin >> choice && choice !=\'q\')
{
switch(choice)
{
case \'a\' :show_real_name(message,5);
cout << endl;
break;
case \'b\' :show_job_ (message,5);
cout <<endl;
break;
case \'c\' :show_bop_name(message,5);
cout << endl;
break;
case \'d\' :show_preference(message,5);
cout <<endl;
break;
default :cout<< \"Please enter a choice\"<<endl;
}
}
return 0;
}
void show_real_name(struct bop message[],int n)
{
for(int i =0;i<n;i++)
cout << message[i].fullname<<endl;
}
void show_job_ (struct bop message[],int n)
{
for(int i =0;i<n;i++)
cout << message[i]. <<endl;
}
void show_bop_name(struct bop message[],int n)
{
for(int i =0;i<n;i++)
cout << message[i].bopname<<endl;
}
void show_preference(struct bop message[],int n)
{
for(int i =0;i<n;i++)
{
if(message[i].preference==0)
cout<<message[i].fullname<<endl;
if(message[i].preference==1)
cout<<message[i]. <<endl;
if(message[i].preference==2)
cout<<message[i].bopname<<endl;
}
}
继续阅读与本文标签相同的文章
上一篇 :
注意!印度激增的时尚需求透露了下一个商机
-
PHP 异常任重而道远
2026-05-18栏目: 教程
-
学生时代所学的一些 C 语言知识点回顾(2)——指针
2026-05-18栏目: 教程
-
假设我们都失去视觉——淘宝的无障碍化建设 | 开发者必读(061期)
2026-05-18栏目: 教程
-
阿里巴巴“新六脉神剑”来了
2026-05-18栏目: 教程
-
RocketMQ消息轨迹-设计篇
2026-05-18栏目: 教程
