Vector it

 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// FLTTRSH :3
//
#include "stdafx.h"
#include <iostream>
#include <vector>
#include <conio.h>
using namespace std;
void AddToVector(vector<int> &, int);
void ProcessOfAvector(vector<int> &, vector<int> &);
void ProcessOfBvector(vector<int> &, vector<int> &);
int _tmain(int argc, _TCHAR* argv[])
{
vector<int> A;
vector<int> B;
vector<int> C;
int n;
cout << "Enter the number of A vector: ";
cin >> n;
AddToVector(A, n);
cout << "Enter the number of B vector: ";
cin >> n;
AddToVector(B, n);
ProcessOfAvector(C, A);
cout << "Vector after the addition of elements of A: ";
for (int i = 0; i < C.size(); i++)
cout << C[i] << " ";
cout << endl;
ProcessOfBvector(C, B);
cout << "Vector after the addition of elements of B: ";
for (int i = 0; i < C.size(); i++)
cout << C[i] << " ";
_getch();
return 0;
}
void AddToVector(vector<int> &V, int n)
{
int tmp;
cout << "Enter elements: \n";
for (int i = 0; i < n; i++)
{
cout << i+1 << ": ";
cin >> tmp;
V.push_back(tmp);
}
}
void ProcessOfAvector(vector<int> &V, vector<int> &After)
{
for (int i = 0; i < After.size(); i++)
if ((After[i] >= 2) && (After[i] < 5))
V.push_back(After[i]);
}
void ProcessOfBvector(vector<int> &V, vector<int> &After)
{
for (int i = 0; i < After.size(); i++)
if (After[i] % 3 == 0)
V.push_back(After[i]);
}