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
Q.drtrdyudoijoemrkdf
sveta [45]

Answer:

Yes

Explanation:

8 0
2 years ago
Read 2 more answers
All of the following are true about in-database processing technology EXCEPT Group of answer choices it pushes the algorithms to
vekshin1

All of the aforementioned are true about in-database processing technology except: D. it is the same as in-memory storage technology.

<h3>What is an in-database processing technology?</h3>

An in-database processing technology can be defined as a type of database technology that is designed and developed to allow the processing of data to be performed within the database, especially by building an analytic logic into the database itself.

This ultimately implies that, an in-database processing technology is completely different from in-memory storage technology because this used for the storage of data.

Read more on database here: brainly.com/question/13179611

#SPJ1

5 0
2 years ago
Define a function group-by-nondecreasing, which takes in a stream of numbers and outputs a stream of lists, which overall has th
Debora [2.8K]

Answer:

def group_by_nondecreasing( *args ) :

     num_list = [arg for arg in args]

     sorted_numlist = sorted( num_list )

     list_stream = [ sorted_numlist, sorted_numlist, sorted_numlist ]

     return list_stream

Explanation:

This python function has the ability to accept multiple and varying amount of arguments. the list comprehension shorten the logical for statement to generate a list of numbers, sorts the list in ascending order by default and duplicates the list in another list.

5 0
3 years ago
Help plzzzzzzzzzzzzzzzzzzzzzzzzz
Reil [10]

B, Parallel ports are faster than serial ports.

A parallel port can move a set of 8 bits at a time on eight different wires, it uses a 25 pin connector, called a DB-25 connector, whereas a serial port only has a DB-9 connector.

7 0
3 years ago
I need help with these
solmaris [256]

Answer:

Choose internet is the right answer

7 0
2 years ago
Other questions:
  • Students recently created a Gaming Club at their school. On Friday of every week, students bring in their gaming consoles (Xbox,
    10·1 answer
  • The keyboard, mouse, trackpad, microphone, light pen, and voice recognition are examples of _____ devices.
    5·1 answer
  • PLEASE HELP ASAP!!!
    15·2 answers
  • What is a symptom of a failing power supply? The display has only a blinking cursor. The computer displays a POST error code. Th
    12·1 answer
  • Which of the following types of network can only be accessed by members within a private organization?
    5·1 answer
  • Recursion is a natural use for a _____ (stack or queue)
    13·1 answer
  • Translate the following C++ program to MIPS assembly program. *Please explain each instruction of your code by a comment and sub
    5·1 answer
  • What is a written or electronic document that outlines etiquette policies for using networks and network resources?
    8·1 answer
  • What does CPU stand for
    7·1 answer
  • Which of the following tiny computer apps is designed to be useful but could cause more harm than good?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!