Repository navigation
Expand file tree
/
Copy pathmain.cpp
More file actions
68 lines (64 loc) · 2.21 KB
/
Copy pathmain.cpp
File metadata and controls
68 lines (64 loc) · 2.21 KB
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
62
63
64
65
66
67
68
#include "intvector.hpp"
#include<iostream>
int main(){
// CONSTRUCTORS
iv::IntVector* v1 = new iv::IntVector(7);
iv::IntVector* v2 = new iv::IntVector(10);
/*************************************************/
// FUNCTIONS
v2->zeros();
v2->print();
v2->ones();
v2->print();
v2->range(6);
v2->print();
// push_back
v1->push_back(12);
v1->push_back(34);
v1->insert_override(5, 42);
v1->print();
/*****************************************************/
/*COUNT*/
size_t result = v1->count(0);
std::cout << "Count of zeros: " << result << std::endl;
/*****************************************************/
/*INDEX*/
int result2 = v1->index(0);
if(result2 == -1){
std::cout << "No result of index" << std::endl;
}else{
std::cout << "First zero index: " << result2 << std::endl;
}
/**************************************************/
int result3 = v1->get_size();
std::cout << "The size of the v1_array: " << result3 << std::endl;
/*****************************************************/
int result4 = v1->get_capacity();
std::cout << "The capacity of the v1_array: " << result4 << std::endl;
// Make it smaller the array
v1->resize(2);
/****************************************************/
int result5 = v1->get_capacity();
std::cout << "The capacity of the new resized v1_array: " << result5 << std::endl;
v1->print();
/****************************************************/
// make it bigger the array
v1->resize(4);
int result6 = v1->get_capacity();
std::cout << "The capacity of the new resized v1_array: " << result6 << std::endl;
v1->print();
/*****************************************************/
/*SUM*/
result6 = v1->sum();
std::cout << "The sum of of array is: " << result6 << std::endl;
/*****************************************************/
/*POP_BACK*/
int result7 = v1->pop_back();
std::cout << "The last number of array is: " << result7 << std::endl;
delete v1;
delete v2;
return 0;
}
// class = osztaly => tervrajz
// v1 = peldany/objektum => instance/object
// v2 = peldany/objektum => instance/object