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
Technician A says that temperature sensors decrease in resistance as the temperature​ increases; this is called positive tempera
Reika [66]

Answer:

Technician B.

Explanation:

The claim of technician B that some vehicle manufacturers use a stepped ECT circuit inside the PCM to broaden the accuracy of the sensor is correct.

6 0
3 years ago
The relationship between social media and the Internet is complex. Individual Internet behavior involves a myriad of factors tha
Artemon [7]

Answer:

Explanation:

The internet could be regarded has a marketplace or platform which gives individuals, businesses the opportunity to interact, relate, access opportunities, learn in an easy manner with the help of a data connection. The internet has redefined the process and concept of acesing information and interaction with the ease and coverage it brings. The Social media is could be seen a part of the internet platform which allows people to relate and interact, make friends, promote brands and so on. The internet and social media platforms however, in spite of its huge benefits comes with its inherent risk. Including the surge in cyber crime, immorality and information theft to mention a few. Common scenarios whereby banking details are being stolen from databases resulting in wholesale illegal transfer of funds. Issues of blackmail and violent defamation by groups of cohorts has also been a con in the advent of internet and social media, including growing trends of fake news which usually escalate tension, in which the recent unrest in my vicinity benefitted negatively from.

7 0
3 years ago
Each column in an access table datasheet represents a ____.
kakasveta [241]
....field while a row represents a record
4 0
2 years ago
Which type of cell references are locked and NOT automatically updated when it’s copied
dsp73

Hi I would have to say B sorry if this answer is sucky but I'm trying my best to help you :D

4 0
2 years ago
What value(s) can be input into this code for the value of number that will cause the code in the loop to execute? Scanner keybo
Marianna [84]

Answer:

There is no value of the number variable, for which the loop can be true in any iteration.

Explanation:

  • The above loop states the condition that the value should be less than 100 and greater than 500. It is because the loop holds the and condition which gives the true if both conditions will be true.
  • The first condition of the while loop states that the value of the number variable is less than the 100.
  • The second condition of the while loop state that the value of the number variable is greater than the 500.
  • The and condition of the while loop will true if both conditions will true.
  • But there is no number which is less than 100 and greater than 500.
  • So no number can satisfy the while condition to be true.

5 0
3 years ago
Other questions:
  • Darpa was created to
    13·1 answer
  • On laptops, wireless cards tend to be attached to which panel?
    8·1 answer
  • Assume the availability of class named DateManager that provides a static method, printTodaysDate, that accepts no arguments and
    11·1 answer
  • 3.
    5·1 answer
  • A cpu handless all the instruction that it recieces from hard ware and software which are available on the computer true or fals
    7·1 answer
  • What are the different alignment options available in Microsoft​
    11·2 answers
  • What do other people think of e.t ( be specifc by putting a line in the story)<br><br> E.T MOVIE
    11·1 answer
  • PLEASE ANSWER! I NEED IN 30 MIN.
    10·1 answer
  • Which option identifies the programming paradigm selected in thr following scenario? A student is writing a science fiction stor
    12·1 answer
  • Enumerate five features of Microsoft excel 2016​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!