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
N76 [4]
3 years ago
6

Write a loop that fills an array int values[10] with ten random numbers between 1 and 100. Write code for two nested loops that

fill values with ten different random numbers between 1 and 100.
Computers and Technology
1 answer:
zalisa [80]3 years ago
7 0

Answer:

#include <iostream>

#include <cstdlib>

using namespace std;

int main() {

   int[] array = new int[10];

   int index = 0;

   while(index < array.size()){

           int number = (rand() % 100) + 1;

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

               array[index] = number;

               cout<< "Position "<< index << "of the array = "<< number << endl;

               ++index;

           }

     }

}

Explanation:

The while loop in the source code loops over a set of code ten times, The for loop only loops once to add the generated random number between 1 and 100 to the array of size 10. At the end of the for loop, the index location and the item of the array is printed out on the screen. The random number is generated from the 'rand()' function of the C++ standard library.

You might be interested in
The picture has the question on it
Bingel [31]

The answer is B. Row

4 0
3 years ago
Consider a collection C of subsets of a nite set V . (V; C) is called a hypergraph. A hypergraph (V; C) is 3-regular if every su
kodGreya [7K]

Explanation:

polynomial-time 3-approximation for the maximum matching problem in 3-regular hypergraphs as follows: Given a 3-regular hypergraph, find a matching with maximum cardinality.

6 0
3 years ago
Write technical term of following statements: a.The set of programs to perform specific task. b.A feature of computer which tell
ExtremeBDS [4]

Answer:

a) Application software

d) Lady Augusta Ada Lovelace

b) (it may be versatility

6 0
2 years ago
2560x1600 (apple)vs 1920x1200 (Dell), is there a big difference between those 2 based on screen resolution ? ​
Solnce55 [7]

Answer:

Yes

Explanation:

1920x1200 is a non-standard resolution which may not be fully supported, usually 1920x1080 (1080p) is preferred and has been standardised as a display resolution.

2560x1600 (WQXGA) is a more standardised display resolution, and will offer a lot sharper and crisper images as more pixels are being used to render the image. As a rule of thumb, the higher resolution - the better.

The difference between these two resolutions is about the same difference as 1080p and 2k, you are going to get twice as crisp an image.

However there are other factors, such as refresh rate that may come into play with a comparison with these two.

3 0
3 years ago
#include using namespace std; int main( ) { const int NUM_ROWS = 2; const int NUM_COLS = 2; int milesTracker[NUM_ROWS][NUM_COLS]
VARVARA [1.3K]

Answer:

#include <iostream>

using namespace std;

int main()

{

   const int NUM_ROWS = 2;

   const int NUM_COLS = 2;

   int milesTracker[NUM_ROWS][NUM_COLS];

   int i = 0;

   int j = 0;

   int maxMiles = -99; // Assign with first element in milesTracker before loop

   int minMiles = -99; // Assign with first element in milesTracker before loop

   milesTracker[0][0] = -10;

   milesTracker[0][1] = 20;

   milesTracker[1][0] = 30;

   milesTracker[1][1] = 40;

   

   maxMiles = milesTracker[0][0];

   minMiles = milesTracker[0][0];

   

   for (i = 0; i < NUM_ROWS; i++){

       for (j = 0; j < NUM_COLS; j++){

           if (milesTracker[i][j] > maxMiles){

               maxMiles = milesTracker[i][j];

           }

           if (milesTracker[i][j] < minMiles){

               minMiles = milesTracker[i][j];

           }

       }

   }

   

   cout << "Min: " << minMiles << endl;

   cout << "Max: " << maxMiles << endl;

   return 0;

}

Explanation:

It seems you want to find the min and max value in the array. Let me go through what I added to your code.

Set the maxMiles and minMiles as the first element in milesTracker

Create a nested for loop that iterates through the milesTracker. Inside the loop, check if an element is greater than maxMiles, set it as maxMiles. If an element is smaller than minMiles, set it as minMiles.

When the loop is done, print the minMiles and maxMiles

5 0
3 years ago
Other questions:
  • Using the expected format, of putting key information where the reader can’t find it, is an example of?
    8·2 answers
  • A troubleshooter's ability to design and test hypotheses in order to solve a technology problem is based on ____.
    14·1 answer
  • Rows within a spreadsheet are identified by:
    8·1 answer
  • Choose a film you have watched, or watch a film you have wanted to. Write a film review in at least three paragraphs. Describe w
    5·1 answer
  • application that will perform a lot of overwrites and deletes of data and requires the latest information to be available anytim
    8·1 answer
  • If you're unsure if something
    9·2 answers
  • Stuart wants to delete some text from a slide. What should Stuart do?
    8·1 answer
  • Select the item that best represents technology transfer?
    8·1 answer
  • Drag each label to the correct location on the image. Match the movie qualities with the right period of movies.
    8·1 answer
  • E commerce is the demand of modern society both for time and money
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!