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
Gre4nikov [31]
3 years ago
6

Write a program that sorts an array of 20 random numbersin the range from 0 through 1000.

Computers and Technology
1 answer:
Nuetrik [128]3 years ago
6 0

Answer:

#include<iostream>

#include<stdlib.h>

#include<time.h>

#include <algorithm>

using namespace std;

//main function program start from here

int main(){

   //seed the rand() function

   srand(time(NULL));

   //initialization

   int arr[20];

   //generate the 20 random number

  for(int i=0;i<20;i++){

   arr[i]=rand()%1000;   //store in array

  }

  sort(arr,arr+20); //sort the array by inbuilt function

  cout<<"The sorted array is."<<endl;

  //for display the each element in the array

  for(int i=0;i<20;i++){

   cout<<arr[i]<<endl;

  }

}

Explanation:

Create the main function and declare the array with size 20.

Take a for loop and generate the random number 20 times. For generating a random number, use the function rand();

rand() function which defines in the library stdlib.h, generate the random number within the range.

for example:

rand() % 20: generate the number between 0 to 19 ( Exclude 20).

for generating the random number different for every time, then we have to use srand() function and time function which defines in time.h library.

After that, store the number in the array.

Finally, take another loop and print all elements one by one.  

You might be interested in
Given four inputs: a, b, c &amp; d, where (a, b) represents a 2-bit unsigned binary number X; and (c, d) represents a 2-bit unsi
Amiraneli [1.4K]

Answer:

z = a.c' + a.b.d' + b.c'.d'

Explanation:

The truth table for this question is provided in the attachment to this question.

N.B - a' = not a!

The rows with output of 1 come from the following relations: 01 > 00, 10 > 00, 10 > 01, 11 > 00, 11 > 01, 11 > 10

This means that the Boolean expression is a sum of all the rows with output of 1.

z = a'bc'd' + ab'c'd' + ab'c'd + abc'd' + abc'd + abcd'

On simplification,

z = bc'd' + ab'c' + ac'd' + ac'd + abc' + abd'

z = ac' + abd' + bc'd'

Hope this helps!

6 0
3 years ago
What command utilizes the limpel-ziv (lz77) compression algorithm and achieves a compression ratio of 60-70 percent?
AURORKA [14]

The limpel-ziv (lz77) compression technique is used by the GNU zip (gzip) tool to produce a compression ratio of 60–70%.

<h3>How do methods for data compression function? Describe the LZW algorithm.</h3>

Compression methods lower the amount of memory needed to hold pictures and the number of bytes needed to represent data. Compression improves the amount of data that can be delivered over the internet and enables the storage of more photos on a given media.

Abraham Lempel, Jacob Ziv, and Terry Welch developed the table-based lookup technique known as LZW compression to compress a file into a smaller file. The TIFF image format and the GIF image format are two frequently used file formats that employ LZW compression.

To know more about limpel-ziv (lz77) compression algorithm, Visit:

<u>brainly.com/question/19878993</u>

#SPJ4

4 0
1 year ago
Which tool is often used by devops to facilitate the development, testing, and deployment of new software?.
ella [17]

The Jenkins tool is often used by DevOps to facilitate the development, testing, and deployment of new software.

<h3>What is software development?</h3>

The practice of conceptualizing, planning, designing, coding, documenting, testing, and bug-fixing that went into building and maintaining applications, platforms, or other software modules is known as software creation.

Jenkins is a Java-based continuous integration/continuous delivery and deployment system that is free and open-source.

Thus, the Jenkins tool is often used by DevOps to facilitate the development, testing, and deployment of new software.

Learn more about software development here:

brainly.com/question/3188992

#SPJ4

3 0
2 years ago
List the steps to look it install and then run a program or mobile app
Luda [366]

Answer:

1. Open a cloud installer (the source), which is usually Play Store, Aptoide, or UpToDown, in the case of Android phones.

2. Request the package from the server, which will be transmitted via an internet connection. Usually called "downloading".

3. Allow the package provider (mobile store) to install the app on the system, this being the "install" part, where it's put together.

4. Run the app by, usually, pressing the icon in the app drawer.

3 0
3 years ago
You've added a clip art image to your slide. Now you want to add a border. Which tab would you use to make this change?
Vinvika [58]
<span>If you want to add a border you have to use 'Insert' tab to make this change. Then you have to click on</span> "Picture" that is placed in the Insert menu, and choose "Clip Art." You can use the search box at the top of the Clip Art gallery in order to find a suitable border. When you finally found it, click on it, then select the button "Insert".
6 0
3 years ago
Read 2 more answers
Other questions:
  • What type of organizational structure would you want to use for this company (by function, by process, by product, and so on)? E
    11·1 answer
  • What are the problems with security when working on a Web Page?
    13·2 answers
  • To the following is not a network connection LAM MAN SAN WAN
    9·1 answer
  • Which of the following cameras is a high-end digital camera that has interchangeable lenses and uses a mirror to display on its
    13·1 answer
  • Do you get notified if someone follows you on Spotify like your email or do you just have to find out on your own
    14·1 answer
  • Which of the following are valid calls to Math.max? 1. Math.max(1,4) 2. Math.max(2.3, 5) 3. Math.max(1, 3, 5, 7) 4. Math.max(-1.
    9·1 answer
  • You need to replace a broken monitor on a desktop system. You decide to replace it with a spare monitor that wasn't being used.
    15·2 answers
  • What type of natural disaster stuck haiti in 2010 and killed more than 200,000 people
    9·2 answers
  • Which iteration must have an expression that has a true or false value?
    10·1 answer
  • To create a datetime object for the current date and time, you can use theGroup of answer choicestoday() method of the date clas
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!