1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
LiRa [457]
3 years ago
5

Write a program that implement a bubble sort ?

Computers and Technology
1 answer:
Tanzania [10]3 years ago
6 0

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
A good reference point for determining the position of a line or curb in front of you is your __________ . A. Hood ornament B. L
Hatshy [7]
I am pretty sure it’s A
5 0
3 years ago
Add comma(s) where needed, if needed.
guajiro [1.7K]

Answer:

My birthday, October 31, 2005, is on Halloween.

Explanation:

4 0
2 years ago
Which of the following is NOT a type of insurance fraud?
inessss [21]

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.

8 0
3 years ago
Read 2 more answers
Explain with examples what is software​
zvonat [6]

Answer:

Software is the data in your computer for example apps

Explanation:

Apps are a form of software

8 0
2 years ago
Write the definition of a function half which recieves a variable containing an integer as a parameter, and returns another vari
Alchen [17]

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>.

5 0
3 years ago
Other questions:
  • Assume that an int variable age has been given a value. Assume further that the user has just been presented with the following
    14·1 answer
  • The term composite would be used to describe an image that was altered by the Crop tool.
    15·1 answer
  • Write a program that asks the user to enter two dates (in YYYY-MM-DD format), and then prints which date is earlier. Your progra
    15·1 answer
  • PreparedStatement ps = connection.prepareStatement("select firstName, mi, lastName from Student where lastName = ?"; ps.setStrin
    5·1 answer
  • David Doe is a network administrator for the ABC Company. David is passed over for promotion three times. He is quite vocal in h
    14·1 answer
  • Gap junctions and plasmodesmata have what feature in common?
    6·1 answer
  • Is this a Bad Cpu processor ? I need some.help ASAP I turn on my.pc and it has no display but everything is on fans and the you
    13·1 answer
  • What is obamams last name
    9·2 answers
  • At a commercial quick charge station, a fully depleted 87 kwh battery in 2023 ariya can be charged from 20% to 80% in about ____
    10·1 answer
  • Given an array of integers a, your task is to calculate the digits that occur the most number of times in the array. Return the
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!