Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

You will create an array manipulation program that allows the user to do pretty much whatever they want to an array. Present the user with

You will create an array manipulation program that allows the user to do pretty much whatever they want to an array.

Present the user with a menu, detect their choice, and provide them any needed follow up prompts that are needed.

When the program begins, you will prompt the user for an initial size of the array, then the values to fill the array. Your array will contain ints. For example, the user could say they want an array of size 5, then you prompt for the 5 values to put in the array.

After the initial array is filled, interact with the user via a menu until they want to quit.

Sample Menu

Make a selection: 1) Insert 2) Remove 3) Count 4) Print 5) Exit Choice: 

Additional Requirements

For each of the options the user has access to, create a function to handle the work involved.

int* insert(int arr[], int size, int value, int position)

Inserts the given value at the specified position

Creates a new array, copies all old value over adjusting indices as necessary

Returns a pointer to the new array

int* remove(int arr[], int size, int position)

Reomves the value at the given position

Creates a new array, copies all old value over adjusting indices as necessary

Returns a pointer to the new array

void print(int arr[], int size)

Prints array as required

Option Description
Insert

The user will provide a position to insert a value

You must obtain a valid position before moving on

Obtain the value to insert and insert it into the array

NOTE: The array will be one element larger after

Remove

The user will provide a position to remove a value

You must obtain a valid position before moving on

Once you have a valid position, remove that value

NOTE: The array will be one element smaller after

Count

Obtain a value from the user

Tell them how many times that value is in the array

Print

Print the contents of the array in the following format:

[1, 3, 99] 
Exit

Exits the program

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

Managing Your Information How To Design And Create A Textual Database On Your Microcomputer

Authors: Tenopir, Carol, Lundeen, Gerald

1st Edition

1555700233, 9781555700232

More Books

Students also viewed these Databases questions

Question

fscanf retums a special value EOF that stands for...

Answered: 1 week ago

Question

=+4 What are non-union workers representations?

Answered: 1 week ago