I have two questions:
1- How can print the values of a for the code stated below???
#include <iostream>
#include <list>
using namespace std;
int main()
{
int i;
list<int> a;
for(i; i<5; i++)
{
a.push_back(i);
}
system("pause");
return 0;
}
2- How can I add new element to an integer array? For example, I have an array such that:
int *a;
int size = 3
a = new int [size];
a[0]=0;
a[1]=1;
a[2]=2;
//Now, I would like to add a new element to my array by increasing its size by one
size += size; // new size is 4
How can I use my array with the new size and add a new element to the end of the array?