C ++ dynamic array without STL

This is part of the assignment, but I just ask you to clarify:

Download data from ATM.txt and save it in a dynamic array (type ATM, not STL) when the program starts.

How can I make dynamic arrays without STL? I thought that perhaps assignment means using pointers, "ATM Type" threw me away.

He mentioned again:

accounts.txt file into a dynamic array (account type, not STL)

- is not part of the destination

I never understood the use of unsafe memory operations, for example, pulling the number of elements in a file from the first line:

eg.

5
abc
def
hij
kml
mno

Wouldn't it be wiser to use STL (vectors or C ++ 11 arrays) and not rely on the number in the file, since it may be inaccurate, causing a buffer overflow, etc.?

// Account.h, : id, BSB ..

, ATM.

+5
5

- , new[], delete[]:

ATM * atms = new ATM[count];
// do stuff with the array
delete [] atms;

, , delete[]. , , , ; . , :

  • - ()
  • /
  • ()

RAII, , , .

: , , , . , . , ; . ( ++, -, ).

STL?

, . ++, , , . , .

+4

. , .

. , , .

+1

, STL, / .

:

  • malloc,
  • /
  • realloc,

, STL-, std::vector, ( !).

:

  • . , , realloc (. std::vector:: reserve)
  • . , , , .
0

STL ( ++ 11 ), , , ..?

std::vector . , std::vector .

, ; " ATM", ATM.txt " ", accounts.txt. , , , , /. , , .

0

, , :

  • myDynamicArray
  • int long
  • "". , STL ( STL), .
  • , (. № 2) , , . pre-++, , ++-, , → → . ? , , 20% . Microsoft # " " , .
  • () , ( "" , ). , , , ( , , ).

, . , , , -, ++.

: http://www.cplusplus.com/doc/tutorial/dynamic/

-1

All Articles