Logo 
Search:

C++ Programming Answers

Ask Question   UnAnswered
Home » Forum » C++ Programming       RSS Feeds
  Question Asked By: Love Bird   on Nov 28 In C++ Programming Category.

  
Question Answered By: Joel Gaitan   on Nov 28

//simple progarmm that can help you easily
#include <iostream.h>
#include <conio>
void main()
{
char choise;
int array[10];
do{
int n;
cout<< " how many number do you have "<<endl;
cin>>n;
cout<<"enter the number you have"<<endl;
for (int i=0;i<n;i++){
cin>>array[i];
}
int i,j;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if(array[i]>array[j])
{
int temp=array[i]; //swap
array[i]=array[j];
array[j]=temp;
}

}

}
cout<<"arrangnment of number in descending order as follows"<<endl;
for(int i=0;i<n;i++){
cout<<array[i]<<endl;
}
cout<<"enter the choise y to continue or n to stop"<<endl;
cin>>choise;

}
while(choise=='y');
getch();
}

Share: