-
Notifications
You must be signed in to change notification settings - Fork 1
/
p307 pair的.cpp
33 lines (31 loc) · 904 Bytes
/
p307 pair的.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//p307 ?pair的验证
#include <iostream>
#include <vector>
#include <list>
#include <utility>
#include <deque>
using namespace std;
int main()
{
pair<string, string> anon;
pair<string, int> word_count;
pair<string, vector<int> > line;
//验证
cout << anon.first <<" " << anon.second << endl;
cout << word_count.first << " " << word_count.second <<endl;
//cout << line.first << " " << line.second << endl; //不能输出
typedef pair<string, string> Author;
Author proust("Narcel", "Proust");
Author jouce("James", "Joyce");
//输出
cout << proust.first << " " << proust.second <<endl;
cout <<jouce.first << " " << proust.second << endl;
//验证make_pair
pair<string, string> next_auth;
string first, second;
cout << "请输入两个字符串" << endl;
cin >> first >> second ;
next_auth = make_pair(first, second);
cout << next_auth.first << " " << next_auth.second <<endl;
return 0;
}