I'm trying to convert a program to OOP. The program works with a few arrays:
int tipoBilletes[9] = { 500,300,200,100,50,20,10,1,2 };
int cantBilletes[9] = {0};
So for my conversion, I declared in the header file this:
int *tipoBilletes;
int *cantBilletes;
and in the constructor I wrote
tipoBilletes = new int[9];
cantBilletes = new int[9];
tipoBilletes[0] = 500;
tipoBilletes[1] = 300;
tipoBilletes[2] = 200;
...
It works fine.
My question is, is there any way to initialize it like in Java?
int[] tipoBilletes = new int[]{ 500,300 };
rather than having to set each element one by one?
std::vector, notnew[]. Also, what benefits are you gaining by changing it from a fixed-size array to a dynamic array?