Functions with Arrays: Sorting ints in Ascending order and deleting a duplicate

Here is the problem:
Write a full program that reads in an arbitrary sequence of integers from the standard input, and writes them to the standard output in sorted order and with all duplicates removed. You may assume the input contains at most 100 integers.

I am having difficulty even compiling this in Xcode. I have five of the same errors:
"type "int" cannot be used prior to "::" because it has no members"
I am unsure as to what that error means.
Additionally I have one additional error:
"No matching function call to '_iterator_category'"

I'm sure there are many things wrong with this code, I just do not know where. It would be great if I could get my code to compile so that I could test my functions.
My solution:

#include <iostream>
#include <string>
#include <fstream>
using namespace std;

bool find(const int array[], int n, int x);
void duplicates(int array[], int n);
void sort(int array[], int n);


int main ()
{

int a=0;
int i=0;
int array[100];

do {
cin >> a;
array[i]=a;
i++;
} while (cin.good());

int n=i;

duplicates(array, n);
sort(array, n);


int y;

for(y=0; y<n; y++)
{
cout<< array[y];
}
return 0;
}

//Requires: n>0
//Modifies: nothing
// Effects: Sorts the array in ascending order
void sort(int array[], int n)
{
int u=0;
for(; u<n; n++)
{
int z=0;
for(; z<n; z++)
{
if(array[u] > array[z])
{
int b;
b=array[u];
array[u]= array[n-1];
array[n-1]=array[u];
}
}
}
}


//Requires: n>0
//Modifies: nothing
// Effects: deletes one duplicate if found
void duplicates(int array[], int n)
{
int k=0;
for(; k<n; k++)
{
if(array[k]==find(array[100], n, array[k]))
{
array[k]=array[n-1];
}
}
}


//Requires: n>0
//Modifies: nothing
// Effects: finds two equal digits
bool find(const int array[], int n, int x)
{
int j=0;
for(; j<n; j++)
{
if(array[j]==x)
{
return true;
}
}
return false;
}


Thanks A TON!
Topic archived. No new replies allowed.