Question: #include using namespace std; void remove_duplicate(int a[], int size) { cout < < Your array after remove duplicate = { ; for (int i =

#include

using namespace std;

void remove_duplicate(int a[], int size) { cout << "Your array after remove duplicate = { "; for (int i = 0; i < size; i++) { for (int j = i + 1; j < size; j++) { if (a[i] == a[j]) { a[j] = a[j + 1]; size--; } } } for (int i = 0; i < size; i++) { cout << a[i] << " "; } cout << "}." << endl; cout << "Your new size = " << size << endl; } int main() { int size = 0; float value; int array[20]; char repeat; do { cout << "Please enter your array (Q/q to stop) = "; while (cin >> value) { if (cin.fail()) { break; } array[size] = value; size++; } cin.clear(); cin.ignore(); cout << "Your array is = { "; for (int i = 0; i < size; i++) { cout << array[i] << " "; } cout << "}. " << endl; cout << "Your array size is = " << size << endl; remove_duplicate(array, size); cout << "Do you want continue (y/n): "; cin >> repeat; } while (repeat == 'y'); cout << "Exit!" << endl; system("Pause"); return 0; } student submitted image, transcription available below

what's wrong whit it? all way missing the last value and don't count the last value.

How to fix it ?

Please enter your array (Q/q to stop) =14916974911q Your array is ={14916974911}. Your array size is =9 Your array after remove duplicate ={149167}. Your new size =5 Do you want continue (y/n)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!