728x90 AdSpace

Latest Article



C C++ Selection Sort Code Example using For Loop





C C++ Selection Sort Code Example using For Loop Source Code Implementation Algorithm

#include<iostream.h>
#include<conio.h>
void main( )
 {
int a[100],v,max,i,j,k=0;
clrscr( );
cout<<"How Many Values U Want TO Enter   : ";
cin>>max;
cout<<"\n\n";
for(i=0;i<max;i++)
{
cout<<"\nEnter A Value  : ";
cin>>a[i];
}
for(i=0;i<max;i++)
{
for(j=i+1;j<=max;j++)
{
if(a[i] > a[j])
{
k=a[i];
a[i]=a[j];
a[j]=k;
}
}
}
cout<<" \n\nThe Sorted List is  :";
for(i=0;i<max;i++)
{
cout<<a[i];
}
getche( );
 }

no image
  • Title : C C++ Selection Sort Code Example using For Loop
  • Posted by :
  • Date : 04:09
  • Labels :






  • Blogger Comments
  • Facebook Comments

0 comments:

Post a Comment