当前位置:网站首页>Exercise: store department information
Exercise: store department information
2022-07-29 07:56:00 【A tong Muyou】
#include <iostream>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
class Employee
{
private:
int id;
string name;
public:
Employee(int i, string n)
{
id = i;
name = n;
}
void show()
{
cout << " Job number : " << id << " full name : " << name << endl;
}
};
int main(void)
{
Employee e1(10, "aa");
Employee e2(11, "ab");
Employee e3(12, "ac");
Employee e4(13, "ad");
Employee e5(14, "af");
Employee e6(15, "ag");
Employee e7(16, "ah");
Employee e8(17, "aj");
multimap<string, Employee> m;
//
m.emplace("salse", e1);
m.emplace("salse", e2);
//
m.insert(make_pair("delpment", e3));
m.insert(make_pair("delpment", e4));
//
m.emplace(pair<string, Employee>("fans", e5));
m.emplace(pair<string, Employee>("fans", e6));
m.emplace(pair<string, Employee>("fans", e7));
m.emplace(pair<string, Employee>("fans", e8));
for(auto &l : m)
{
cout << " department :" << l.first << " ";
l.second.show();
}
return 0;
}
#include <iostream>
#include <stack>
#include <queue>
using namespace std;
int main(void)
{
stack<int> s;
for(int i=0; i<10; i++)
{
s.push(i);
}
cout << s.top() << endl;
cout << s.size() << endl;
cout << "________________" << endl;
while(!s.empty())
{
cout << s.top() << endl;
s.pop();
}
cout << "________________" << endl;
queue<int> q;
for(int i=0; i<10; i++)
{
q.push(i);
}
cout << q.front() << endl;
cout << q.back() << endl;
cout << q.size() << endl;
cout << "________________" << endl;
while(!q.empty())
{
cout << q.front() << endl;
q.pop();
}
cout << "________________" << endl;
priority_queue<int,deque<int>,less<int>> p;
for(int i=0; i<10; i++)
{
p.emplace(i);
}
cout << p.top() << endl;
cout << p.size() << endl;
cout << "________________" << endl;
while(!p.empty())
{
cout << p.top() << endl;
p.pop();
}
cout << "________________" << endl;
}
边栏推荐
- 【深度学习】数据准备-pytorch自定义图像分割类数据集加载
- LVM logical volume group management
- [freeze electron microscope] analysis of the source code of the subtomogram alignment function of relion4.0 (for self use)
- Excellent urban design ~ good! Design # visualization radio station will be broadcast soon
- Compare three clock circuit schemes of single chip microcomputer
- 在一个sql文件中,上面定义一个测试表及数据,下面可以select* from 测试表
- Ionicons icon Encyclopedia
- What are the principles and methods of implementing functional automation testing?
- flutter只要是数据,都会判空的
- Actual measurement of boot and pH pins of buck circuit
猜你喜欢
Measured waveform of boot capacitor short circuit and open circuit of buck circuit
[untitled] format save
[paper reading | cryoet] gum net: fast and accurate 3D subtomo image alignment and average unsupervised geometric matching
Dynamic Thresholds Buffer Management in a Shared Buffer Packet Switch论文总结
功能自动化测试实施的原则以及方法有哪些?
Cs61abc sharing session (VI) detailed explanation of program input and output - standard input and output, file, device, EOF, command line parameters
10 practical uses of NFT
What are the principles and methods of implementing functional automation testing?
cs61abc分享会(六)程序的输入输出详解 - 标准输入输出,文件,设备,EOF,命令行参数
监听页面滚动位置定位底部按钮(包含页面初始化定位不对鼠标滑动生效的解决方案)
随机推荐
Day 014 二维数组练习
Research on autojs wechat: the final product of wechat automatic information sending robot (effective demonstration)
Data warehouse modeling, what is wide table? How to design? Advantages and disadvantages
Sqlmap(SQL注入自动化工具)
[deep learning] data preparation -pytorch custom image segmentation data set loading
Pat class a 1146 topology sequence
NLP introduction + practice: Chapter 5: using the API in pytorch to realize linear regression
For the application challenge of smart city, shengteng AI gives a new solution
Matlab simulation of LDPC minimum sum decoding based on high-order six ring free
EF core reading text type is slow_ EF core is slow to read large string fields
[skill accumulation] presentation practical skill accumulation, common sentence patterns
Monitor the bottom button of page scrolling position positioning (including the solution that page initialization positioning does not take effect on mouse sliding)
Day 014 2D array exercise
UPC little C's King Canyon
Solve the problem that the disk is full due to large files
[memo] summary of the reasons why SSH failed? Remember to come next time.
@Use of jsonserialize annotation
Detailed explanation of the find command (the most common operation of operation and maintenance at the end of the article)
Space shooting Lesson 17: game over (end)
[paper reading | cryoelectron microscope] interpretation of the new subtomogram averaging method in relion 4.0