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

Write a c++ program that generates three random numbers. The first number should be between 0-30, the second number should be be

tween 30-60 and the third number should be between 60-90.
Computers and Technology
1 answer:
Rama09 [41]3 years ago
8 0

Answer:

#include <stdlib.h>

#include <time.h>  

#include <iostream>

using namespace std;

int main() {

   srand(time(NULL));

   cout << rand() % 30 << endl;

   cout << rand() % 30 + 30 << endl;

   cout << rand() % 30 + 60 << endl;

}

Explanation:

rand() returns a pseudo-random integral number in the range between 0 and RAND_MAX. By applying the modulo operator, you map that to the desired range (30 in your case), then you add an offset.

You might be interested in
Can someone tell me how to hit on a link on Brainly to see the answer
3241004551 [841]
No, please do not hit on links. they're viruses i'm pretty sure.
7 0
3 years ago
Read 2 more answers
Just answer the 2 questions. THX
pogonyaev

Answer:

A then D

Explanation:

3 0
3 years ago
Imagine that you've properly connected your multimeter into an operating circuit, and the meter's function/range switch is set t
Free_Kalibri [48]
If the meter is set to  read DC voltage in the 20 volt range and it displays a 1 then it should mean 1 volt assuming that the maximum reading would be 20 volts at that setting. But if it is only around 1 volt is might be more accurate to set it at say 2V range to get say 1.6 actual volts.
8 0
3 years ago
Read 2 more answers
True / False
Tju [1.3M]

Answer:

TRUE, The PC is always incremented by the same amount in fixed-length instruction set architectures.

Explanation:

Its TRUE that Program Counter ( PC ) is always incremented by the same amount in fixed - length instruction set architectures ( fixed length ISA) . As the instruction set length is fixed in fixed - length instruction set architectures, the Program Counter to fetch the next instruction set it has to be incremented by fixed length. This fixed length depends on the hardware of the architecture (the number of bytes each machine word contains and number of machine words per memory location)

7 0
4 years ago
What is the output of the following code snippet? int age = 25; if (age &gt; 30) { System.out.println("You are wise!"); } else {
Lunna [17]

Answer:

You have much to learn!

Explanation:

In the question the variable age has been declared and assigned the value of 25.

The if Statement checks if age >30 to output "You are wise!" else it will output "You have too much to learn"

Since age has been assigned the value of 25, we expect the program to execute the else block which is "You have too much to learn"

4 0
3 years ago
Other questions:
  • What is not critical when you are first designing a database?
    9·1 answer
  • Please answer quick:))))
    7·1 answer
  • Write a method that takes three numerical String values and sums their values.
    14·2 answers
  • A technician has verified that a video card to be added to a desktop machine will fit and so will a new sound card. What should
    15·1 answer
  • Katarina is deciding whether to buy a desktop or a laptop computer. What will most likely help Katarina make her decision?
    10·2 answers
  • Which custom configuration is most likely to include a raid array?
    14·1 answer
  • Write an expression that prints 'You must be rich!' if the variables young and famous are both True. Sample output with inputs:
    9·1 answer
  • An engine that generates hot, expanding gases by burning fuel inside the machine.
    9·1 answer
  • Taking control of admin functionality and misusing sensitive data that are unauthorized to access are due to.
    8·1 answer
  • Why do we need to connect computers"​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!