Write a program in C/C++ that receives a series of integer values from the user. The user nominates the number of values to be saved (n) and then enters the values one at a time. This set of values must be stored in an array. After the values are saved in the array, it must be displayed again on the screen as output. The user then nominates an element that has to be removed from the array (n-th element) . The program must ensure that the value for n is valid. After the value has been deleted, the array must be displayed to the user again. Tip: To erase an element, the elements are moved to overwrite the nth element. Note that the array can now save one more position than there are elements. The number of "active" elements in the array must be updated every time.   See example input and output below:     Enter the number of values to enter: 5 Enter the value for array value 0: 1 Enter the value for array value 1: 2 Enter the value for array value 2: 3 Enter the value for array value 3: 4 Enter the value for array value 4: 5 Value 0 is 1 Value 1 is 2 Value 2 is 3 Value 3 is 4 Value 4 is 5 Enter the index of the value you wish to remove: 2 Value 0 is 1 Value 1 is 2 Value 2 is 4 Value 3 is 5

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%

Write a program in C/C++ that receives a series of integer values from the user. The user nominates the number of values to be saved (n) and then enters the values one at a time. This set of values must be stored in an array. After the values are saved in the array, it must be displayed again on the screen as output.

The user then nominates an element that has to be removed from the array (n-th element) . The program must ensure that the value for n is valid. After the value has been deleted, the array must be displayed to the user again.

Tip: To erase an element, the elements are moved to overwrite the nth element. Note that the array can now save one more position than there are elements. The number of "active" elements in the array must be updated every time.

 

See example input and output below:

 

 

Enter the number of values to enter: 5

Enter the value for array value 0: 1
Enter the value for array value 1: 2
Enter the value for array value 2: 3
Enter the value for array value 3: 4
Enter the value for array value 4: 5

Value 0 is 1
Value 1 is 2
Value 2 is 3
Value 3 is 4
Value 4 is 5

Enter the index of the value you wish to remove: 2

Value 0 is 1
Value 1 is 2
Value 2 is 4
Value 3 is 5

Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY