-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
34 lines (24 loc) · 755 Bytes
/
main.cpp
File metadata and controls
34 lines (24 loc) · 755 Bytes
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
#include <iostream>
#include "dynamic_array.h"
int main()
{
// Specify the data type inside <data_type>
DynamicArray<string> arr(3);
// We can add a single element
arr.add_element("1");
// Or we can use { } to pass multiple elements at once
arr.add_element({"97", "2", "3", "3"});
// Displays all the elements
arr.display_element();
// This returns the size of the array and the number of elements in it
arr.return_size();
/* This removes the number specified
(If there are two or more same numbers, it removes the last one.)
*/
arr.pop_element("3");
arr.return_size();
// Returns the value of array in index 0
cout << arr[0] << endl;
arr.display_element();
return 0;
}