编程,输入十名职工的姓名和职工号
答案:3 悬赏:0 手机版
解决时间 2021-03-10 04:45
- 提问者网友:我一贱你就笑
- 2021-03-10 01:05
编程,输入十名职工的姓名和职工号
最佳答案
- 五星知识达人网友:煞尾
- 2021-03-10 01:14
//c++
#include<iterator>
#include<iostream>
#include<map>
#include<string>
using namespace std;
void main()
{
map<string, int>database;
int i = 0;
while(i++<10)
{
cout << "请输入姓名和职工号,第"<<i<<"位" << endl;
string name;
int ID;
cin >> name >> ID;
database[name]=ID;
}
cout << "下面是统计结果:" << endl;
for (const auto &i : database)
cout << i.first << " " << i.second << endl;
}
#include<iterator>
#include<iostream>
#include<map>
#include<string>
using namespace std;
void main()
{
map<string, int>database;
int i = 0;
while(i++<10)
{
cout << "请输入姓名和职工号,第"<<i<<"位" << endl;
string name;
int ID;
cin >> name >> ID;
database[name]=ID;
}
cout << "下面是统计结果:" << endl;
for (const auto &i : database)
cout << i.first << " " << i.second << endl;
}
全部回答
- 1楼网友:人间朝暮
- 2021-03-10 03:12
那好吧不大好
- 2楼网友:一袍清酒付
- 2021-03-10 02:49
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
//c++
#include
#include
#include
#include
usingnamespacestd;
voidmain()
{
mapdatabase;
inti = 0;
while(i++ {
cout string name;
intid;
cin >> name >> id;
database[name]=id;
}
cout for(constauto&i : database)
cout }
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯