GianPDev / -2019-03-ADS103_Module_1.1_ArrayLists

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Module 1.1 - ArrayLists (Uni work)

“You are asked to create your own list including at least 5 items you bought in the last week.”

The video discusses everything in Java but you need to use C++ to write your own solution. (n.d.). Array Lists. From Java: Data Structures. Retrieved from %0asa%3atrue%0aproducttypeid%3a2



  • Typing anything other than an Int when removing a value, will create an infinite loop.


Array can expand as needed.

Duplicates allowed.

Indexed, add/remove elements by index.


Difficulties / Notes:

  • In the language I learned; Haxe, Arrays can dynamically change size or be at a fixed size depending on how it’s created, so it was a surprise that Arrays in C++ are only fixed size.

  • The task only specifies creating “your own list of including at least 5 items”, does not specify if you need to create a List or a ArrayList data type.
    The task links to a video about Array Lists, but does not specify whether or not to use it.

  • In Haxe, it is easy to get the length of the array by getting arrayOfThings.length

  • Haxe Arrays is declared similar to C++ vectors
    var arrayOfThings:Array<String>;
    using namespace std;
    vector<string> arrayOfThings;

  • Getting the size of an array or vector returns an unsigned int. I had warnings because I just created signed int for my for loop iterators

  • In C++, functions must be placed before main (need to test if this is necessary in Haxe)

ezoic increase your site revenue



Language:C++ 100.0%