Lab section | Computer Science homework help


Lab Section: e.g. CP107-[1 2]-[A B C] Lab Assignment: Lab9 Pointers & StructsProject 

Name: Lab9_1 Array Builder Description: Dynamically allocates a new integer array or larger integer arrayLimitations:Credits: 

Includes mandatory file header:- uses empty Win32 Console Application:- Programs submitted with correct folder structure and correct files (cpp & h):user Interface (10%):———————- Clean easy-to-use:- Informed user of application:- Prompted user for input data:- Leaves cursor at end of line prompting input:- Correct spelling in user interface: Source Code Formatting (40%):—————————— Descriptive Names for functions and variables:- Correct Use of Indentations:- Effective use of newlines:- Use of local variables:- Misuse of global variables:- Effective use of comments:- Use of constants and enums:Demo Results (40%):——————– Compiles w/o errors:- Instructor pause included in all return paths:- Input validation done according to requirements:- Produced expected program output:- <program spectific>Test Coverage (5%):——————– Program output included:- Boundary conditions tested:*/#include <iostream>
using namespace std;int * arrayBuilder(int * arr, int size, int newSize);void showArray(int * arr, int size);int main(){int * theArray = 0;int i;cout << “This program demonstrates an array builder function.” << endl << endl;// create the initial array. The initial size is zero and the requested size is 5.theArray = arrayBuilder(theArray, 0, 5);// show the array before values are addedcout << “theArray after first call to builder: ” << endl;showArray(theArray, 5);// add some values to the arrayfor(int i = 0; i < 5; i++){theArray[i] = i + 100;}// show the array with added valuescout << endl << “Some values stored in the array: ” << endl;showArray(theArray, 5);// expand the size of the array. size is not the original size. newSize// must be greater than size.theArray = arrayBuilder(theArray, 5, 10);// show the new array with the new sizecout << endl << “The new array: ” << endl;showArray(theArray, 10);cout << endl;delete [] theArray; // be sure to do this a1t the end of your program!system(“pause”);return 0;}/*FUNCTION: arrayBuilderINPUTS: Pointer to an array. Size of the array. If size is zero, arr can be NULL.
Size of the new array.OUTPUTS: Returns a pointer to allocated memory. If newSize is greater than size, an array of newSize is allocated and the old array is copied into the new array. Memory pointed to by the old array is deleted. All new elements are initialized to zero.*/int * arrayBuilder(int * arr, int size, int newSize){// TODO: Your code goes here// HINT: Design the function before writing it.return NULL; // default return value. No memory allocated!}/*FUNCTION: showArrayINPUTS: Pointer to an array. Size of the array. If size is zero, arr can be NULL.OUTPUTS: Prints the contents of the array to the console.*/void showArray(int * arr, int size){cout << “arr = “;for(int i = 0; i < size; i++){cout << arr[i] << ” “;}cout << endl;}


Place this order or similar order and get an amazing discount. USE Discount code “GET20” for 20% discount