Goodbye Duplicates! <-How to program?
Write a program that will read in N numbers, each of which is between 1 and 100, inclusive. As each number is read, print it only if it is not a duplicate of a number already read.
Specs:
Use functions for the user inputs as well as displaying the output and array manipulation.
Use c++ language.
INPUT:
The first lin of inputs is the number of inputs cases (N), which is a positive integer that does not exceed 100. the succeeding N lines specify the integers that the program reads.
OUTPUT:
Print out each unique element of thee array preceded by "#x - ", where x is the element number. Then, print out the elements with duplicates, in the order of their occurrence during input, separated by a space.
This is my current code:
Code:
#include<iostream>
#include<conio.h>
#include<stdlib.h>
using namespace std;
int inputs(int);
int numero[101];
main()
{
int numbers;
cin>>numbers;
if (numbers>100 || numbers<1) { system("cls"); main(); }
else { inputs(numbers); }
system("cls");
main();
}
int inputs(int numbers)
{
int a;
for (int x=1; x<=numbers; x++)
{
cin>>numero[x];
if (numero[x]==numero[x]) { a=numero[x]; }
else if (numero[x]==numero[x]) { a=numero[x]; }
}
cout<<"b "<<a;
}