I have attempted to make a class similar to vectors in c++ (Though, I now know that it's just a (doubly) linked list). Just wanna know, how good or efficient my program is, how well I am as a programmer. What about my coding style. Is it messy to read? constructive criticism is welcomed and appreciated.
#include <iostream>
struct node
{
int num;
node* next = NULL;
node* prev = NULL;
};
class _vector
{
node *n1 = new node();
node *n = n1;
public:
void push_back(int num)
{
node* temp = new node();
this->n1->num = num;
this->n1->next = temp;
temp->prev = n1;
this->n1 = temp;
}
void pop_back()
{
n1 = n1->prev;
n1->next = NULL;
}
void display()
{
while(n->next != NULL)
{
std::cout<<n->num<<'\n';
n = n->next;
}
}
};
int main()
{
_vector v;
for(int i=0;i<100;i++)
v.push_back(i);
v.pop_back();
v.pop_back();
v.pop_back();
v.pop_back();
v.pop_back();
v.display();
return 0;
}