array, string, file i/o

Last edited on
The problem with asking for outside guidance is that the answers given by engineers aren't acceptable coming from a student, and answers given by other students may not fit your teacher's expectations either.

Even the first function (displayA) can be written in a dozen different ways, starting with at least three ways it could be called (taking an array by reference, a pair of pointers, or a pointer with a size)

The main problem with this assignment that I see are "addElementA" and "deleteElementA": arrays cannot change in size for the duration of their lifetime, it is impossible to add an element or to erase an element.

If you were using vectors, this would be trivial (addElementA() would call push_back(), and deleteElementA() would call erase()), but with arrays these functions would have to create a new array, larger/smaller than the original, populate it as necessary, and destroy the old array. Which immediately imposes another requirement, that the arrays must be allocated with new[] and passed to the functions via pointers.
Topic archived. No new replies allowed.