Im pretty much new to C++ and trying to write a program for class that asks a user input for an array, ends with a sentinel, and deletes duplicate integers, i can get the integers to list but cant figure out the function to delete duplicates and repost the list, can anyone help me?
here is my current program, dont laugh if its completely wrong:
#include <iostream>
using namespace std;
const int SIZE=20;
const double SENTINEL = -99.0;
int main()
{
int list[SIZE];
int n;
int i = 0;
int actSize;
cout << "Please enter in a series of numbers, '-99.0' to end " << endl;
for (i = 0; i < SIZE && i != SENTINEL; i++)
cin >> n;
if (list[i] == SENTINEL) {
actSize= i - 1;
}else{
actSize = SIZE;
}
cout << list[0] << " ";
for (int i = 0; i < actSize; i++)
{
bool matching = false;
for (int j = 0; (j<i) && (matching == false); j++)
#include <iostream>
usingnamespace std;
constint SIZE=20;
constdouble SENTINEL = -99.0;
int main()
{
int list[SIZE];
int n;
int i = 0;
int actSize;
cout << "Please enter in a series of numbers, '-99.0' to end " << endl;
for (i = 0; i < SIZE && i != SENTINEL; i++)
cin >> n;
if (list[i] == SENTINEL) {
actSize= i - 1;
}else{
actSize = SIZE;
}
cout << list[0] << " ";
for (int i = 0; i < actSize; i++)
{
bool matching = false;
for (int j = 0; (j<i) && (matching == false); j++)
if (list[i] == list[j]) matching = true;
cout << list[i] << " ";
}}