Write a program that inputs 10 integers from the user into an array, and removes
ID: 3642865 • Letter: W
Question
Write a program that inputs 10 integers from the user into an array, and removes the duplicate array elements. By removing, I meant that you should make it appear as if the elements hadn't been there. So not just setting duplicates to an "empty" value, but filling in the gap. That means moving all the later elements back one (kind of like when you hit backspace in the middle of a line in a text editor). Or alternatively, storing only the non-repeating elements. You may assume that all the integers are between 0 and 100, Write at least 1 function in addition to the main function, and pass an array into that function as a parameter.Output should look exactly like below. Two rows.
Program Input:
0
1
2
3
4
5
6
7
8
9
Program Output:
Please enter 10 integers, hitting return after each one:
0 1 2 3 4 5 6 7 8 9
Program Input:
100
100
100
100
100
100
100
100
100
100
100
Program Output:
Please enter 10 integers, hitting return after each one:
100
Program Input:
11
11
22
22
33
33
44
44
55
55
Program Output:
Please enter 10 integers, hitting return after each one:
11 22 33 44 55
Program Input:
12
37
12
37
45
88
101
21
21
101
Program Output:
Please enter 10 integers, hitting return after each one:
12 37 45 88 101 21
Explanation / Answer
#include using namespace std; void eliminate(int a[], int &siz) { for (int i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.