[LC++]Seperate an array into smallest to highest elements

Mark Phillips mark at austrics.com.au
Tue Feb 19 12:22:03 UTC 2002


Ezra Taylor wrote:
> 
> Hello all:
>                      I'm new to C++, if this question is to infantile for
> this list; lash me with kindness.
> 
> Now, I want to take an array with x elements and separate(print) them
> into smallest to highest elements.  The array is already sorted.  Please
> use novice C++ explanations.

If I understand correctly what you want to do, it would be something
like this:

int const x=100;
int myArray[x];

for (int i=0; i<x; ++i)
  cout<<"myArray["<<i<<"] = "<<myArray[i]<<endl;

Is that what you wanted to do?

Cheers,

Mark.



More information about the tuxCPProgramming mailing list