Write a Program in C++ to Search a no. Using (Selection Sorting Method)
5:29 AMuse 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
0 comments