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
What type of object can offer the most effective way to display data and calculations in a presentation?
poizon [28]

This is definitely an opinion, but an excel you can do A and D and just about the same as B also

<u>So i'd say C </u>

8 0
2 years ago
What coding language should i begin with if i'm looking to get into AI ?
loris [4]

Depends really. Have you got prior coding experience? The semantics of certain languages are much easier to pick up if you've had prior experience, but it might seem impossible to someone who has minimal experience.

Assuming that you're no older than 15 or 16, I'm going to suggest Python. It's a simple, high-level language that's easier to understand than most languages. If you think you've got enough experience to quickly understand and pick up things, then I'd probably say R is a good language to start with. It's very well-suited for AI and tends to be a favourite for AI researchers.

7 0
3 years ago
A(n) _______________ CRM provides all users with the tools and information they need to fit their individual roles and preferenc
fgiga [73]
A(n) "Portal-based" CRM provides all users with the tools and information they need to fit their individual roles and preferences.
4 0
3 years ago
Which of the following examples illustrates the Crowding Out Effect?
maks197457 [2]

your answer is c to what your looking for



6 0
3 years ago
Imagine that you are helping a customer needing technical assistance for a printer they recently purchased. They bought the prin
Lisa [10]
If you happen to meet that kind of problem, the most appropriate series of steps to take in troubleshooting the issue is that first, are there steps that i haven't done? If there's no power even if it is plugged in, try to check the wire. Look for a different wire cable and connect it to your printer. If it still does not work, then check it over to the service center.
3 0
3 years ago
Read 2 more answers
Other questions:
  • Ben buys an Olympus E-PL2 from Sony which starts malfunctioning. When he opts for an exchange, the customer representative says
    11·1 answer
  • strategy that is used to help improve the chances that your site will be found by search engines is known as search engine
    12·1 answer
  • Press the ____ key(s) to erase one character to the left of the insertion point.
    10·2 answers
  • ----------HELP WITH 3 QUESTIONS FOR 30 POINTS!!!---------
    6·1 answer
  • Who is the founder of javascript? ​
    14·2 answers
  • Question 16 (1 point)
    15·1 answer
  • In one to two sentences, explain why citizens pay taxes
    8·1 answer
  • How much does a dodge tomohawk cost for a used one?
    7·1 answer
  • What type of technology we need to use in order to make sure that users can freely room from one room to another one without wi-
    14·1 answer
  • What report provides data on how specific sections of a website performed?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!