­

Write a Program in C++ to Search a no. Using (Selection Sorting Method)

5:29 AM


use header files iostream.h,process.h and conio.h then

 void main()
{
      int array[100],n,i,j,temp;
      clrscr();
      cout<<"How many numbers--> ";
      cin>>n;
      cout<<"Enter "<
      for(i=0;i
                  cin>>array[i]; //created by sourabh
      for(i=0;i
      {
                  for(j=i+1;j
                              if(array[i]>array[j])
                              {
                                          temp=array[i];
                                          array[i]=array[j];
                                          array[j]=temp;
                              }
      }
      cout<<"\nArray is sorted in ascending order.\n";
      for(i=0;i
                  cout<
      getch();
}

Output:-
How many numbers--> 3
Enter 3 numbers
4
7
6
Array is sorted in ascending order.
4   6   7

You Might Also Like

0 comments

Popular Posts

Like us on Facebook

Create your own banner at mybannermaker.com!

Flickr Images