Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#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

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

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

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Vi Special Issue On Database And Expert Systems Applications Lncs 7600

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2012th Edition

3642341780, 978-3642341786

More Books

Students also viewed these Databases questions

Question

1. What makes Zipcar an attractive employer for whom to work?

Answered: 1 week ago