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
Is it possible to uninstall a program that's on your phone from computer?
kirill [66]
Yes it is. Depending on your operating system there are many ways to uninstall a program. On Windows you go to Add or Remove Programs in the control panel which shows all of your uninstalled programs, you select the program you want to uninstall and click the “uninstall button”. I am not sure how it is on Mac or Linux though. On iOS you can hold down an app icon for a few seconds and press the “X” on the app icon to uninstall, you you can uninstall it from the settings app too. On Android it can be uninstalled from the settings app.
6 0
3 years ago
How to revert a dismissed javascript popup alert box in chrome?
xeze [42]
When Google Chrome blocks pop-ups for you, the blocked pop-up alert icon <span>appears in the address bar. If you click on the icon, you can see the pop-ups that have been blocked for that page. If you'd like to allow pop-ups for that specific site:</span><span><span><span>
1. Click the pop-up alert icon  (in the address bar).</span>
</span><span>2. Click the link for the pop-up you'd like to see.
</span><span>3. To always see pop-ups for the site, select "Always show pop-ups from [site]." 

</span></span><span>If you'd like to proactively allow pop-ups for specific sites:
</span><span><span><span>1. Click the Chrome menu   in the top right hand corner of your browser.</span>
</span><span><span>2. Select Settings.</span>
</span><span><span>3. Click Show advanced settings</span>
</span><span><span>4. Under the "Privacy" section, click the Content settings button.</span>
</span><span>5. In the "Pop-ups" section, select "Do not allow any site to show pop-ups." 
</span>6. Click the 'Manage exceptions' button.
<span>7. Type in the url of the site that you'd like to allow pop-ups from.</span></span>
5 0
3 years ago
Commercial applications are never free<br><br> -True<br><br> -False
Ber [7]

Answer:

False

Explanation:

Commercial applications such as google and brainly don't cost money but usually there is a way to pay and get better quality or cooler things.

8 0
3 years ago
Firefox, Chrome, Opera, and Safari are examples of
MrRissso [65]
D. Browsers

You're on one right now! :)

3 0
3 years ago
Which of the following electronic payments is ideal for micropayments?
timama [110]

Answer:

B. smart cards

Explanation:

3 0
3 years ago
Read 2 more answers
Other questions:
  • Blogs are typically written by large companies or organizations as a way to express formal, technical, or scholarly information
    5·2 answers
  • In 1-2 paragraphs discuss the three main purposes of design and provide examples for each. Also explain how a design might serve
    15·1 answer
  • What does subscribing to a website’s RSS feed provide to a subscriber?
    10·1 answer
  • William has an internet connection that does not allow him to make calls when connected to the internet. what internet service c
    7·2 answers
  • PLEASE HELP, True or False: The term whitespace speaks to the design of a website
    8·2 answers
  • Your company has a wireless network for its small office network. The wireless network does not broadcast its service set identi
    11·1 answer
  • Which statement best describes antivirus software?
    13·1 answer
  • What is the long tube on a microscope called​
    15·1 answer
  • What are the routes through with Virus transmitted into computer<br>system?​
    15·1 answer
  • Please choose odd one out please tell fast​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!