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]
2 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]2 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
Which of the following is equivalent to (p&gt;=q)? <br> i) P q iv) !p Where are genius people?:)
Elena L [17]

Answer:

Explanation:

This is unsolvable if you have no variable substitutes

4 0
2 years ago
What is a very important difference there between the wiring of an electromechanical thermostat and an electronic programmable t
valentinak56 [21]

Answer:

A mechanical thermostat will typically use a bimetal strip with two different metals that expand/contract with the temperature at different rates.

Explanation:

7 0
2 years ago
Which tools are found in the Quick Analysis feature? Check all that apply.
a_sh-v [17]

Answer:

A, C, E

Explanation:

8 0
3 years ago
Read 2 more answers
Describe how a black and white image could be represented in binary
SIZIF [17.4K]

Answer:

Each pixel in an image is made up of binary numbers. If we say that 1 is black (or on) and 0 is white (or off), then a simple black and white picture can be created using binary. To create the picture, a grid can be set out and the squares coloured (1 – black and 0 – white).

5 0
3 years ago
Read 2 more answers
Write a program that prompts the user to input a number. The program should then output the number and a message saying whether
Gala2k [10]

Answer:

Following is the program in C++ Language

#include <iostream> // header file

using namespace std; // namespace std

int main() // main method

{

   int n;  // variable declaration

   cout<<" Please enter the number :";

   cin>>n; // Read the number

   if(n>0) // check the condition when number is positive

   {

cout<<n<<endl<<"The number is Positive"; // Display number

   }

  else if(n<0) // check the condition when number is Negative

  {

cout<<n<<endl<<"The number is Negative";// Display number

  }

  else // check the condition when number is Zero

  {

cout<<n<<endl<<"The number is Zero";// Display number

  }

   return 0;

  }

Output:

Please enter the number:

64

The number is Positive

Explanation:

Following are the description of the program

  • Declared a variable "n" of int type.
  • Read the value of "n" by user.
  • Check the condition of positive number by using if block statement .If n>0 it print the number is positive.
  • Check the condition of negative number by using else if block statement If n<0 it print the number is negative.
  • Finally if both the above condition is fail it print the message " The number is Zero"

7 0
3 years ago
Other questions:
  • What is a quick way to close the header or footer view in a microsoft word document?
    12·1 answer
  • An instruction book or program that takes users through a prescribed series of steps to learn how to use a program is called (a)
    10·1 answer
  • Fact about energy that will make a knex car move
    7·2 answers
  • US-CERT is a set of moderated mailing lists full of detailed, full-disclosure discussions and announcements about computer secur
    15·1 answer
  • Edhesive code practice 4.8 Question 3
    5·2 answers
  • Identify some advantages of using Excel over lists, paper files, or simple word documents? Describe some disadvantages of using
    15·1 answer
  • Super Scores
    11·1 answer
  • at the grocery store alexa by 1 1/3 lb of ground turkey nasha by two times as much ground turkey is alexa how much ground turkey
    9·1 answer
  • What is data intergrity​
    13·1 answer
  • Five types of conflict in the school​
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!