阅读以下说明和C++代码,将应填入 (n) 处的字句写在答题纸的对应栏内。
【说明】
C++标准模板库中提供了map模板类,该模板类可以表示多个“键-值”对的集合,其中键的作用与普通数组中的索引相当,而值用作待存储和检索的数据。此外,C++模板库还提供了pair模板类,该类可以表示一个“键-值”对。pair对象包含两个属性:first和second,其中first表示“键-值”中的“键” ,而second表示“键-值”中的“值”。
map 类提供了 insert 方法和 find 方法,用于插入和查找信息。应用时,将一个 pair对象插入(insert)到 map 对象后,根据“键”在 map 对象中进行查找(find),即可获得一个指向pair对象的迭代器。
下面的 C++代码中使用了 map和 pair 模板类,将编号为 1001、1002、1003 的员工信息插入到map对象中,然后输入一个指定的员工编号,通过员工编号来获取员工的基本信息。员工编号为整型编码,员工的基本信息定义为类employee。
map对象与员工对象之间的关系及存储结构如图5-1所示。
【C++代码】
#include <iostream>
#include <map>
#include <string>
using namespace std ;
class employee{
(1) :
employee(string name,string phoneNumber, string address){
this->name = name;
this->phoneNumber = phoneNumber;
this->address = address;
}
string name;
string phoneNumber;
string address;
};
int main( )
{
map <int, employee*> employeeMap;
typedef pair <int, employee*> employeePair;
for (int employIndex = 1001; employIndex <= 1003; employIndex++){
char temp[10] ; //临时存储空间
_itoa(employIndex,temp,10); //将employIndex转化为字符串存储在temp中
string tmp( (2) ); //通过temp构造string对象
employeeMap. (3) ( employeePair ( employIndex,
new employee("employee-" + tmp,
"85523927-"+tmp,
"address-"+tmp)
)
); //将员工编号和员工信息插入到employeeMap对象中
}
int employeeNo = 0;
cout << "请输入员工编号:";
(4) >> employeeNo; //从标准输入获得员工编号
map<int,employee*>::const_iterator it;
it = (5) .find(employeeNo); //根据员工编号查找员工信息
if (it == employeeMap.end()) {
cout << "该员工编号不存在 !" << endl;
return -1;
}
cout << "你所查询的员工编号为:" << it->first << endl;
cout << "该员工姓名:" << it->second->name << endl;
cout << "该员工电话:" << it->second->phoneNumber << endl;
cout << "该员工地址:" << it->second->address << endl;
return 0;
}
(1)public (2)temp (3) insert (4) cin (5) employeeMap
本题主要考查C++程序设计语言中类库的使用。题干中已经给出了Map类和Pair类的使用方式,Map类主要用于存储一组员工的信息,而Pair类则主要用于建立员工号和员工信息的对应关系,员工信息主要使用类employee的对象来存储。C++语言的类生成对象时,需要调用类的构造方法,因此,employee的构造方法应该为公有构造方法,空缺(1)处的答案应该为public;空缺(2)处的代码主要是根据字符数组temp[10]来构造一个string对象,参数应为temp;空缺(3)处的代码是构造员工对象,并将员工对象和员工编号放入一个Pair对象中,再将Pair对象插入到employeeMap中,根据题干说明,Map类中insert方法完成插入对象的功能,因此,空缺(3)处应该填入insert;空缺(4)处的自的是从标准输入中获得员工编号,标准类库中已经定义了标准输入为cin;空缺(5)处是根据用户输入的员工编号,查取员工信息,Map类中的find方法可完成该功能,而当前员工的编号和员工信息都存储在Map类的实例employeeMap中。
( )is that it provides guidance and direction on how quality will be managed and verified throughout the project.
( )the process of determining,documenting,and managing stakeholder needs and requirements to meet Project objectives.
The information security management system preserves the confidentiality,integrity and availability of information by applying a( ).
( )is a decentralized database,ensure that the data will not be tampered with and forged.
( )puts computer resources on the web,and must meet the requirements of super capacity,super concurrency,super speed and super security.
分配甲、乙、丙、丁四个人去完成五项任务。每人完成各项任务时间如表所示。由于任务多于人数,故规定其中有一个人可兼完成两项任务,其余三人每人完成一项。为了花费时间最少,( )应该完成两项任务。
已知某公司生产AB两种产品,其中生产1件A产品需要1个单位的甲资源,3个单位的丙资源;生产1件B产品需要2个单位的乙资源和2个单位的丙资源。已知现有甲乙丙三种资源4个单位、12个单位和18个单位。通过市场预测,可知A产品的单位市场利润为2元,B产品的单位市场利润为5元。该公司获得最大的市场利润应生产A产品(68)件,此时(69)资源仍有剩余。
已知某公司生产AB两种产品,其中生产1件A产品需要1个单位的甲资源,3个单位的丙资源;生产1件B产品需要2个单位的乙资源和2个单位的丙资源。已知现有甲乙丙三种资源4个单位、12个单位和18个单位。通过市场预测,可知A产品的单位市场利润为2元,B产品的单位市场利润为5元。该公司获得最大的市场利润应生产A产品(68)件,此时(69)资源仍有剩余。
某项目2016年投资额12万元,2018年开始取得项目的净收益(产品一原料辅料及公用工程)6万元/年,2018-2021年每年还会产生其他成本(包括人员工资、管理成本、制造成本等)1.1万元/年;増值税0.35万元/年、营业税金及附加0.05万元/年。则该项目的静态投资回收期为(66)年,截止到2021年底该项目的投资收益率是(67)。
安全审计的手段主要包括( )。