Ok, below you see a program that spits out primes, fibonacci, and "pennies per day" in ascending order.
The problem is I need to create an array and have it print out in descending order as well...hence the switch (sort) for when the time comes. If someone could give me a kick in the pants in the right direction, I swear once this program is done you'll never see me again...LOL! Thanks, y'all have been a Godsend over the last year!!!

Christina



void __fastcall TForm1::bbDisplayClick(TObject *Sender)
{
int number, sort, n, s;
int ArrDisplay[30];
number=rgNumberSeries->ItemIndex;
sort=rgSort->ItemIndex;

switch (number)
{
case 0: n=1;break;
case 1: n=2;break;
case 2: n=3;break;
};

switch (sort)
{
case 0: s=1;break;
case 1: s=2;break;
};

if (n==1)
{
RichEdit1->Lines->Clear();
if (s==1)
{
int first=0, second=1, fib;

for (int k=0; k<28; k++)
{
fib=first+second;
RichEdit1->Lines->Add(fib);
first=second, second=fib;
}
RichEdit1->Lines->Insert(0,0);
RichEdit1->Lines->Insert(1,1);
}
}

if (n==2)
{
RichEdit1->Lines->Clear();
if (s==1)
{
RichEdit1->Lines->Insert(0,1);
const int sievesize = 125;
vector<int,allocator<int> > sieve(sievesize, 1);

for (int i = 2; i * i < sievesize; i++)
if (sieve[i])

for (int j = i + i; j < sievesize; j += i)
sieve[j] = 0;

for (int j = 2; j < sievesize; j++)
if (sieve[j])
RichEdit1->Lines->Add(j++);
}
}

if (n==3)
{
RichEdit1->Lines->Clear();
if (s==1)
{
double p, pennies;
pennies=.01;
p=.02;
RichEdit1->Lines->Insert(0,.01);
for (int l=0; l<29; l++)
{
pennies+=p;
p*=2;
RichEdit1->Lines->Add(pennies);
}
}
}

}