diff --git a/vector.cpp b/vector.cpp new file mode 100644 index 0000000..31c3618 --- /dev/null +++ b/vector.cpp @@ -0,0 +1,98 @@ +#include +using namespace std; + + +#define ll long long int +#define vi vector +#define vvi vector +#define pb push_back +#define fo(i,a,b) for(int i=a ; i class vectorClass +{ + P* a; + int size,current; + +public: + vectorClass() + { + a = new P[1]; + size = 1; + current = 0; + } + void push(P data) + { + if (current == size) { + P* temp = new P[2 * size]; + + for (int i = 0; i v; + v.push(1); + v.push(2); + v.push(3); + v.push(4); + v.push(5); + + cout << "Vector size : " << v.vecsize() << endl; + cout << "Vector capacity : " << v.getcapacity() << endl; + cout << "Vector elements : "; + v.print(); + v.pop(); + cout << "Vector elements after one pop: "; + v.print(); + + + return 0; +} + + + +