Write a program that implement a bubble sort ?
1 answer:
Answer:
A program that implement a bubble sort:
#include<iostream.h>
#include<conio.h>
int main()
{
int ar[50],no,i,j,temp;
cout<<"Enter array size ";
cin>>no;
cout<<"Enter array elements ";
for(i=0;i<no;++i)
cin>>ar[i];
for(i=1;i<no;++i)
{
for(j=0;j<(no-i);++j)
if(ar[j]>ar[j+1])
{
temp=ar[j];
ar[j]=ar[j+1];
ar[j+1]=temp;
}
}
cout<<"Bubble Sort array";
for(i=0;i<no;++i)
cout<<" "<<ar[i];
return 0;
}
You might be interested in
Answer:
My birthday, October 31, 2005, is on Halloween.
Explanation:
Answer:
Arson
Explanation:
Because arson is setting something on fire on purpose to cause damage.
The others all are some form or another of insurance fraud.
Answer:
Software is the data in your computer for example apps
Explanation:
Apps are a form of software
Answer:
int half(int x){
int a=x/2;
return a;
}
Explanation:
function <em>half(x) </em> which has return type <em>integer </em> and accept an <em>integer </em>type parameter <em>'x' </em> and return the an <em>integer </em> value in variable <em>'a' </em> which is closest to <em>half</em> that of the parameter '<em>x'</em> .