#include<iostream.h>
void ascending(int,int);
int main()
{
int array_size=10;
int numbers[]={3,54,23,0,677,45,77,342,4,10};
cout<<"The numbers are: "<<endl;
for(int i=0;i<10;i++)
{
cout<<numbers[i];
}
cout<<"the ascending form is: "<<endl;
ascending( numbers[], array_size);
return 0;
}
void ascending(int numbers[], int array_size)
{
int i, j, index;
for (i=1; i < array_size; i++)
{
index = numbers[i];
j = i;
while ((j > 0) && (numbers[j-1] > index))
{
numbers[j] = numbers[j-1];
j = j - 1;
}
numbers[j] = index;
}
}
veru 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
veru 0 Newbie Poster
Ancient Dragon 5,243 Achieved Level 70 Team Colleague Featured Poster
chaines51 0 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.