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]
3 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]3 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
Wich type of operating system is usually used in personal computers
Anvisha [2.4K]
The three most common operating systems for personal computers are Microsoft Windows, Apple Mac OS X, and Linux.
4 0
3 years ago
Read 2 more answers
How do you do basic addition and subtraction in binary, octal and hex?
olasank [31]

Explanation:

The use of numerical systems arose from the need of man to improve certain mathematical calculations as time goes.

Several factors demanded the study and application of mathematical operations using decimal numbers. Among these factors, technological advancement essentially from the first experiments in the use of electronics.

There are several numeric systems, but four of them stand out: decimal, binary, octal and hexadecimal.

The decimal system is used every day in countless ways and, no doubt, is the most important number system. He has ten digits with which can form any number through the law.

Non-decimal systems such as binary, octal and hexadecimal are critical in the areas of digital and computer techniques. Through these systems is possible to perform logical combinations and working with computer programming languages. This article will show the link between the logical circuits and these numbering systems.

2 - The Binary Numbering System

The binary numbering system is composed of only two digits:

Zero (0)

One (1)

To represent zero amount using the number 0; to represent a quantity, use the digit 1.

Assuming you need to represent the number two. Which digit you can use, if there is no number 2 in that system?

We have the following response. In the decimal system, we do not have the number ten and represent the amount of ten using the digit 1 followed by the digit 0. In this case, the number 1 means that we have a group of ten and the digit 0, no drive, which means ten.

In the binary system, do likewise. For you the amount of two, we use the digit 1 followed by the digit 0. The figure 1 means that there is a group of two elements and 0, a group of any unit, thus representing the number two.

The table below helps us to understand the differences between the decimal and binary system, using this rule. The number sequence displayed to the number nine.

Decimal

Binary

0

0

1

1

2

10

3

11

4

100

5

101

6

110

7

111

8

1000

9

1001

2.1 - System Conversion binary to Decimal System

To better understand the conversion we use a decimal number either, for example, 356. This number means:

3 x 100 + 5 x 10 + 6 x 1 = 356

Hundred ten unit

3 x 10 � + 5 x 10 � 6 x 10 + 10 = 356

We realize that the least significant digit (6) multiplies the unit (1), the second digit (5) multiplies the ten (10) and the most significant (3) multiplies the hundred (100). The sum of these results will represent the number.

In General, the formatting rule of a number is the sum of each digit multiplied by the corresponding base (in the example, the number ten) high for an index as the positioning of the digit in the number.

In another situation, we will use a binary number, for example, the number 101. We can conclude that it is equivalent to number 5 in the decimal system. Using the concept of a number, we will convert the number to the decimal system as follows:

1 0 1

1 x 2� + 0 x 2� + 1 x 2

6 0
3 years ago
You want to be super private with your email. You'd like to be able to download your email to a single device, then remove it fr
DENIUS [597]

Since the person want to be super private with your email, the email protocol can you use to do that is POP 3.

<h3>What is  POP3 about ?</h3>

POP3 is known to be a tool that gives one room to be able to download email to a single device, which a person want to use if they want to add privacy to their emails.

Therefore, Since the person want to be super private with your email, the email protocol can you use to do that is POP 3.

Learn more about email from

brainly.com/question/24688558

#SPJ1

8 0
2 years ago
Blogs differ from most other online text sources because they
allochka39001 [22]
Tell you what a person's life is like
4 0
3 years ago
Read 2 more answers
Which of the following is NOT a career in the Information Support and Services pathway?
frosja888 [35]

Answer:

here yuuuurrrrr Vote for me nah jk

6 0
2 years ago
Other questions:
  • What are you guys doing?
    13·2 answers
  • You plan to use the Fill Down feature on a formula in Excel and need to keep a cell reference the same. Which format allows you
    6·1 answer
  • Which Supreme Court case resulted in a decree issued for the Michigan Department of Corrections to provide female inmates access
    10·1 answer
  • An application needs to calculate sales tax for purchases. You decide to simplify the code by putting the sales tax calculation
    9·1 answer
  • Which are the benefits of leveraging web technologies?
    8·2 answers
  • You have noticed that one of your DNS servers has possibly been compromised. You believe that a cached DNS entry for your domain
    8·1 answer
  • Choose the statement that describes an advantage of paying a bill through the mail with a check.
    6·2 answers
  • If the user enters any operator symbol other than , -, *, or /, then an UnknownOperatorException is thrown and the user is allow
    8·1 answer
  • A--------- provides an easy way to enter or display a record​
    5·2 answers
  • You have been working as a junior data analyst at Bowling Green Business Intelligence for nearly a year. Your supervisor, Kate,
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!