#include #include using namespace std; /* * range (version that returns a pointer) * Return a pointer to a heap-allocated array * Expect that anyone calling the function will free it with delete[] */ int* range(int start, int end, int step, int *length){ // TODO: Finish this } /* * range (version that returns an STL vector) * Return a vector of integers * Declare it as a vector * Instead of indexing to assign values, use push_back() * So if you call your vector result, you add values like this: * result.push_back(new_value); */ vector range(int start, int end, int step){ // TODO: Finish this } int main(){ /* Once you finish range, this should work */ int length; int *array = range(14, 62, 5, &length); for(int i = 0; i < length; i++) cout << array[i] << " "; cout << "\n"; delete[] array; /* * Perhaps you'd prefer something like this, as Python does */ for(int i : range(14, 62, 5)) cout << i << " "; cout << "\n"; return 0; }