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

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

 

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;}

"96% of our customers have reported a 90% and above score. You might want to place an order with us."

Essay Writing Service
Affordable prices

You might be focused on looking for a cheap essay writing service instead of searching for the perfect combination of quality and affordable rates. You need to be aware that a cheap essay does not mean a good essay, as qualified authors estimate their knowledge realistically. At the same time, it is all about balance. We are proud to offer rates among the best on the market and believe every student must have access to effective writing assistance for a cost that he or she finds affordable.

Caring support 24/7

If you need a cheap paper writing service, note that we combine affordable rates with excellent customer support. Our experienced support managers professionally resolve issues that might appear during your collaboration with our service. Apply to them with questions about orders, rates, payments, and more. Contact our managers via our website or email.

Non-plagiarized papers

“Please, write my paper, making it 100% unique.” We understand how vital it is for students to be sure their paper is original and written from scratch. To us, the reputation of a reliable service that offers non-plagiarized texts is vital. We stop collaborating with authors who get caught in plagiarism to avoid confusion. Besides, our customers’ satisfaction rate says it all.

© 2022 Homeworkcrew.com provides writing and research services for limited use only. All the materials from our website should be used with proper references and in accordance with Terms & Conditions.

Scroll to Top