Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help. _C ++ programs Task C. Using arrays to store, update, and retrieve numbers. Write a program edit-array.cpp that creates an array of 10

Please help. _C ++ programs image text in transcribed
Task C. Using arrays to store, update, and retrieve numbers. Write a program edit-array.cpp that creates an array of 10 integers, and provides the user with an interface to edit any of its elements. Specifically, it should work as follows: 1. Create an array myData of 10 integers. 2 Fill all its cells with value 1 (using a for loop). 3 Print all elements of the array on the screen. . Ask the user to input the cell index i and its new value v SIf the index 1 is within the array range (0 s i upd- asked cell, myData [ i] . v . and go back to the step 3. Otherwise, if index i is out of range, the program exits The repetition of the steps 3-4-5 can be implemented with a do while loop: / make array and fill it with 1 do t 1 print the array / get i and v from the user rif i is good, update the array at index i while (...): /if the index was good, repeat The program should keep running until the user inputs an out-of-range (invalid) index. Examplo: s./edit-array Input index: 8 Input value: 99 Input index: 0 Input value: 300

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

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

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions