Making objects within the application

I am slowly learning more and more about C++ and more importantly programming technique and I have reached the wall that I am sure quite a few before me have probably hit - refrences/pointers and management of the heap. Whilst I try and familiarize myself with the above, I am trying to stay ontop of the stuff that I have already learnt, but in doing this have met another wall in which I believe is quite important to get past.

I have basically made a bank account program with help from another question I asked here, and have got to the point where I would like to implement a createNewAccount() method, which at first seemed pretty simple to me until I had a good think about it and how it would be done.

The problem I am having is creating objects inside of the program, is this even possible? From my understanding, each bankAccount must have its own object named appropriatly and this is what I am struggling to achieve. For example, for my case I could just use the accountID for the name of each object and have a method as following which would in turn produce the constructor which would sort everything else out.

void createNewAccount()
{
bankAccount lastAccNumber++
}

Is this above even possible? Can you make an object using the contents of variables in this fashion? Or must it always be a predefined string?

If the above is actually do able, as said above it would work in my case, but what do you do if the object you are using that does have a incremental key field like for example Flowers or Coins?

I know it is a very large question and probably not explained well, but the topic is really something I need to understand and any help on it would be greatly appreicated.

Not without enough difficulty to make it impractical. What you probably want are unnamed objects, or a collection of them in this case. For that there are collection classes such as std::vector. For example:

Ah that makes perfect sense and I have got a working system up using that now. One question I do have is the way in which you define the vector, is it safe/good programming structure to declare it outside the main as below?

is it safe/good programming structure to declare it outside the main as below?

Global variables are generally perceived as poor practice because anything and everything can touch them. This makes debugging exceptionally difficult. It's recommended that you pass the variables around as function arguments if possible:

Hi. so this is actually a continuation from another question of mine[Here](https://www.daniweb.com/programming/software-development/threads/506795/dynamically-add-values-into-datagridview-cell-from-listbox-vb2010) but i was advised to start a new thread as the original question …

I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...

Write a C program that should create a 10 element array of random integers (0 to 9). The program should total all of the numbers in the odd positions of the array and compare them with the total of the numbers in the even positions of the array and indicate ...