Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using c++ Q4. Code, compile and upload the following program. Name it Q4.cpp Array Manipulation) a) Initialize a partially filled array of size 10 with

image text in transcribed

using c++

Q4. Code, compile and upload the following program. Name it Q4.cpp Array Manipulation) a) Initialize a partially filled array of size 10 with the following values 10, 20, 30, 40, 50. (Note that the array is sorted by numerical value) b) Create a printArray function that outputs the array to the console c) Create an isFull function that returns true if the array is full. d) Create an append function that adds a value to the end of the array if there is space. e) Create a getindexof function that returns the position of a specified element in the array, -1 if the element does not exist. f) Create a getSortedPosition function that returns the index a given element would occupy if added to the array in size order. For example, fone were to call get the postion of 35 the returned index value would be 3 (10, 20, 30, 35, 40, 50). g) Main should output if the array is full or not (use isFull) h) Main should append the value of 75 (if there is space) and print the array i) Main should output the index of 30 (use getlndex). j) Main should output the potential position of 35 (use getSortedPosition). * All console output should be from main, not from the functions Output Example Array contains: 10, 20, 30, 40, 50, Array has space. Array after append: 10, 20, 30, 40, 50, 75, Index of 30: 2 Size order position of 35: 3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions

Question

In what ways do lenders and investors lend legitimacy to a firm?

Answered: 1 week ago

Question

Explain the function and purpose of the Job Level Table.

Answered: 1 week ago