I am working on a program where a user keeps entering numbers, which are saved into an array, when the array is full I am trying to copy the original array into a new one one and continue to fill that array however I cannot get it to work at all. Here is my code so far
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
int main()
{
int size;
cout << "Please enter how many numbers you want to enter: ";
cin >> size;
double *array = new double*[size];
cout << "Please enter your numbers: ";
for(int i = 0; i < size; i++) {
cin >> array[i];
if(i == size-1) {
int newSize = 2*size;
double *arrayb = new double*[newSize];
for(int i = 0;i<size;i++) {
arrayb[i] = array[i];
}
delete [] array;
array = arrayb;
size = newSize;
}
}
}