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
Nina [5.8K]
2 years ago
7

How can i take out a random (double) number in between 5.0 to 15.0 in c++?

Computers and Technology
1 answer:
ollegr [7]2 years ago
3 0

Answer:

#include <iostream>

using namespace std;

int main() {

   srand(time(0));

   for(int i=0;i<5;i++)

   {

      double f = (double)rand() / RAND_MAX;//generating random numbers.

       double a= 5.0 + f * (15.0 - 5.0);//random numbers in range provided.

       cout<<a<<" ";

   }

return 0;

}

Explanation:

The above program generate five random numbers in the range 5.0 to 15.0.The function rand() is used to generate random numbers.First we have to call srand(time(0)) otherwise the rand() function will generate same random numbers over and over every time.

You might be interested in
Why is it a good idea not to change the subject line when replying to a message?
Sedbober [7]

Answer:

the correct answer is <em><u>C</u></em>

Explanation: i just did it on edge 2021

4 0
2 years ago
Read 2 more answers
Firefox, Chrome, Opera, and Safari are examples of
MrRissso [65]
D. Browsers

You're on one right now! :)

3 0
3 years ago
Please answer quick :(​
Karo-lina-s [1.5K]

Answer:

1<2 or 15<6 is true

2<4 and 7< 3 is false

not(7>2) is false

6 0
11 months ago
Read 2 more answers
You defined a shoe data type and created an instance.
Assoli18 [71]

Answer:

myShoe.type = 'sneaker'

Explanation:

type is a field of the class shoe. The myShoe object which is an instance of the class shoe has the field type also.

To assign a value to type filed of the object myShoe, reference the object then the field as such;

   myShoe.type = "sneaker"

7 0
1 year ago
A write the result P*=++j where j is 24
MariettaO [177]

Answer:

ang hrap nmn nyan

Explanation:

poede po

7 0
2 years ago
Other questions:
  • Dial-up connections can be made over a(n) ____ line or phone line. isdn dsl ipx tcp/ip
    12·1 answer
  • . How is a form used?
    10·1 answer
  • Select
    14·1 answer
  • Write a Program in C language using arrays:
    14·1 answer
  • What would be the best engine to use for making a 3d beginner game
    9·1 answer
  • The engineering firm you work for is submitting a proposal to create an amphitheater at a state park. Proposals must be submitte
    15·1 answer
  • Fill up the blank:- The picture that graphically represents the items you use in Windows is called a/an .......
    5·1 answer
  • 4. UPS stands for Uninterrupted Power Supply . (Yes /no
    11·1 answer
  • What is the value of the variable named result after the following code executes?
    10·1 answer
  • IPv4 and IPv6 are addresses used to identify computers on the Internet. Is this whether true or not:
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!