-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
72 lines (57 loc) · 1.84 KB
/
main.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
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
69
70
71
72
#include <iostream>
#include "Vector.hpp"
/*
* Feel free to test your the Vector through this file and compile the target
* 'application'.
*/
int main()
{
// ---------------------------------------- //
// ------- Example: Push and insert ------- //
// ---------------------------------------- //
// {
// Vector<std::string> myVector;
// myVector.push_back("Hello");
// myVector.insert(1, "world");
// for (int i = 0; i < myVector.size(); i++) {
// std::cout << myVector[i] << " ";
// }
// std::cout << std::endl;
// }
// ---------------------------------------- //
// ----- Example: Using custom struct ----- //
// ---------------------------------------- //
// {
// struct TextEditor
// {
// std::string Name;
// int Grade;
// }
// Vector<TextEditor> myVector;
// myVector.push_back({"Notepad++", 5});
// myVector.push_back({"VS Code", 8});
// myVector.push_back({"VIM", 10});
// for (int i = 0; i < myVector.size(); i++) {
// TextEditor& editor = myVector[i];
// std::cout << "Editor:\t" << editor.Name << "\t"
// << editor.Grade << "/10" << std::endl;
// }
// std::cout << std::endl;
// }
// // ---------------------------------------- //
// // ---------- Example: 2D vector ---------- //
// // ---------------------------------------- //
// {
// Vector<Vector<int>> nestedVector;
// for (int i = 10; i < 20; i++)
// {
// Vector<float> subVector;
// for (int j = 0; j < 10; j++)
// {
// subVector.push_back(i + j);
// }
// nestedVector.push_back(subVector);
// }
// }
return 0;
}