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
Scrat [10]
3 years ago
6

using C++ to sort user input. for example, user enter 25numbers and sort them from small to big or big to small, cout thesamlles

t, the middle one on the sort list ( in 25 number would bethe 13th number) and the biggest?

Computers and Technology
1 answer:
Umnica [9.8K]3 years ago
4 0

Answer:

C++ code:

#include<iostream>

using namespace std;

void sort(int al[30], int l)

{

//we use insertion sort to sort the array.

int p,q,k;

for(q=1;q<l;q++)   //starting from the 2nd item of the array.

{

 k= al[q];   //taking qth item as key value.

 p=q-1;

 while(p>=0 && al[p]>k)

 {

  al[p+1]=al[p]; //all items those are greaer than al[q] are shifted //to right.

  p=p-1;

 }

 al[p+1]=k;

}

}

int main()

{

int p,l, arrl[30];

cout<<"Enter the number of items in your array: ";

cin>>l;

cout<<endl;

 

cout<<"Enter your "<<l<<" items"<<endl;

for(p=0;p<l;p++)

{

 cin>>arrl[p];

}

 

sort(arrl, l);  //call function sort() to sort the array.

 

cout<<"The array after sorting: ";

for(p=0;p<l;p++)

{

 cout<<arrl[p]<<" ";

}

cout<<endl;

 

cout<<"The smallest item is: ";

cout<<arrl[0]<<endl;

 

cout<<"The middle item is: ";

cout<<arrl[l/2]<<endl;

 

cout<<"The biggest item is: ";

cout<<arrl[l-1]<<endl;

}

Output is given as image.

You might be interested in
Cual es la relacion existe entre TENGNOLOGIA y la PRODUCCION DE ENERGIA
andrezito [222]

Answer:

la tecnología tiene energía para hacer que los dispositivos funcionen, que es como los humanos y la energía. Los seres humanos usan energía, ¡la tecnología también usa energía!

Explanation:

ps. this is in english, my home language

technology has energy to make devices work, which is like humans and energy. human beings use energy, technology uses energy too!

5 0
3 years ago
Notice that the percentages range from just over 55% to just under 65%. This is a range of 10%, so we're going to use 5 evenly-s
vfiekz [6]

Answer:

import numpy as np

l_int = 55/100

h_int = 65/100

hist = np.histogram( paid_tax_preparers_list, bins=5, range=(l_int, h_int))

Explanation:

Numpy is a Python package used to ease mathematical and statistical research calculations. The package creates data structures called arrays that can be used as vector items, making it easy and fast for calculation to be done.

The np.histogram method is used to create or plot histograms of a list or array against the frequency of the items in the array. The bins and the range attributes are used to adjust the display of the histogram, with bins being the number of bin in the graph and range is the given length of the histogram.

7 0
3 years ago
Quick!!!!!
Vlad [161]

Answer:

B. the current affairs page

Explanation:

it's a simple question

8 0
4 years ago
Read 2 more answers
The ___ bar changes depending on which tool is currently selected…?
rodikova [14]

Answer: Options (I'm not 100% sure but I think its options.) Have a nice day!

6 0
3 years ago
Read 2 more answers
Which are characteristics of pseudocode? Select all that apply.
jeka94

Answer:

A,B,C

Explanation:

3 0
3 years ago
Other questions:
  • In databases and database-related software, which choice is not a Boolean operator?
    7·2 answers
  • Define binary number and decimal number with example​
    14·1 answer
  • What are comments meant to do?
    12·1 answer
  • After an entry in the medical record has been written or keyed and an error is discovered, what procedure should be followed to
    7·1 answer
  • You have noticed that one of your DNS servers has possibly been compromised. You believe that a cached DNS entry for your domain
    8·1 answer
  • Complete the steps to evaluate the following
    13·2 answers
  • A Homecoming Crossword Puzzle
    12·1 answer
  • What is the number system that uses only the numbers 0 and 1?
    8·1 answer
  • True or False: A private access modifier is normally used with methods
    8·2 answers
  • Which of the following includes premium content you must pay to use?<br> On word
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!