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
hram777 [196]
2 years ago
12

Higher Order Functions used for simulations of dice rolls. Definition: An n-sided dice function takes no arguments and always re

turns an int from 1 to n, inclusive. Types of n-sided dice functions: - Randomized: a randomized dice function can be fair, meaning that ir produce each possible outcome from 1 to n with equal probability. Examples: four_sided, six_sided - Deterministic: a deterministic dice function will be used for testing. Deterministic test dice functions always cycle through a fixed sequence of n values. - We write a make_fair_dice higher-order function to return a fair, randomized n-sided dice function. - We write a make_test_dice higher-order function that will return a deterministic, testing n-sided dice function.
Computers and Technology
1 answer:
tiny-mole [99]2 years ago
5 0

Answer:

#include <iostream>

#include <time.h>

#include <string>

using namespace std;

int main(){

srand(time(NULL));

cout<<"Throw dice"<<endl;

int b =0;

int a=0;

a=rand()%6;

b=rand()%6;

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

{cout<<"dice one: "<<a<<endl;}

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

{cout<<"dice two: "<<b<<endl;}

if(a>b)

{cout<<"first dice won"<<endl;}

if(b>a)

{cout<<"second dice won"<<endl;}

else{cout<<"they are same"<<endl;

return main();

}

return 0;

}

Explanation:

/*best dice roll game just for you change it as you want but all necessary things are there/*

You might be interested in
If you were infiltrating a network (10.16.0.0/16), and searching for vulnerabilities (while trying to remain undetected), why wo
Juliette [100K]

Answer:

Yes, if you want to be undetected.

Explanation:

It is vital to always use a command that will ensure that one's activity is undetected. This is one of the important rules of corporate organizations to keep their data and activities safe and secure. The commend provided is a useful tool for detective works especially the activities of criminals and hackers. Therefore, if the admin wants to be undetected, the command should not be used.

8 0
2 years ago
Read 2 more answers
A bin contains 100 sty le a notebooks, 100 style b notebooks, and 100 style c notebooks. antoine will select 3 notebooks from th
emmasim [6.3K]
<span>The answer is Ten.  Substituting numbers for letters, available selections are 111, 112, 113, 122, 123, 133, 222, 223, 233, 333.  Note that, for example, 112, 121, and 211 are considered as the same selection.
</span>AAA, BBB, CCC, <span>AAB, AAC, </span><span>BBC, </span><span>ABB, ACC, </span><span>CCB & ABC.</span>
7 0
3 years ago
2. Consider a 2 GHz processor where two important programs, A and B, take one second each to execute. Each program has a CPI of
allsm [11]

Answer:

program A runs in 1 sec in the original processor and 0.88 sec in the new processor.

So, the new processor out-perform the original processor on program A.

Program B runs in 1 sec in the original processor and 1.12 sec in the new processor.

So, the original processor is better then the new processor for program B.

Explanation:

Finding number of instructions in A and B using time taken by the original processor :

The clock speed of the original processor is 2 GHz.

which means each clock takes, 1/clockspeed

= 1 / 2GH = 0.5ns

Now, the CPI for this processor is 1.5 for both programs A and B. therefore each instruction takes 1.5 clock cycles.

Let's say there are n instructions in each program.

therefore time taken to execute n instructions

= n * CPI * cycletime = n * 1.5 * 0.5ns

from the question, each program takes 1 sec to execute in the original processor.

therefore

n * 1.5 * 0.5ns = 1sec

n = 1.3333 * 10^9

So, number of instructions in each program is 1.3333 * 10^9

the new processor :

The cycle time for the new processor is 0.6 ns.

Time taken by program A = time taken to execute n instructions

=  n * CPI * cycletime

= 1.3333 * 10^9 * 1.1 * 0.6ns

= 0.88 sec

Time taken by program B = time taken to execute n instructions

= n * CPI * cycletime

= 1.3333 * 10^9 * 1.4 * 0.6

= 1.12 sec

Now, program A runs in 1 sec in the original processor and 0.88 sec in the new processor.

So, the new processor out-perform the original processor on program A.

Program B runs in 1 sec in the original processor and 1.12 sec in the new processor.

So, the original processor is better then the new processor for program B.

5 0
3 years ago
After running a Google Search Ads campaign for several months, Meredith notices sales of her advertised products are starting to
lesya692 [45]

Answer:

The campaign could be improved by 78% if the listed recommendations are followed.

Explanation:

While conducting the following Search advertising program for a few months, Meredith has announced that revenues of its branded goods are beginning to slow. She reviews her Google Advertising Suggestions webpage which states that her campaign's performance ranking is 22 points.

Thus, the campaign will be increased by 78% if the above recommendations are implemented to inform Meredith regarding its Google Search Advertising plan.

5 0
3 years ago
Which feature of a blog helps to store and retrieve older posts?
Rashid [163]
Could it be archive posts? I'm not sure, but I believe it's archive posts.
8 0
3 years ago
Read 2 more answers
Other questions:
  • On the Insert tab, select Table &gt; _______ to create a table from selected text.
    14·1 answer
  • A ____ instruction copies data bits to storage locations and can copy data between any combination of registers and primary stor
    11·1 answer
  • A database has a built-in capability to create, process and administer itself.
    14·1 answer
  • The cold war actually helped in the development of the internet true or false
    8·1 answer
  • im in honors comupter science and one of my questions is evaluate 18% 7 does anyone know how to answer that
    6·1 answer
  • The part of the computer that contains the brain or the Central Park nursing unit is also known as
    10·1 answer
  • i know this not school related but my grandmothers RCA RCT6272W23 tablet is saying type password to decrypt storage and i dont k
    5·1 answer
  • The word Only is absolute or qualified
    8·2 answers
  • List three features of the third generation of computers
    13·1 answer
  • explain the following joke: “There are 10 types of people in the world: those who understand binary and those who don’t.”
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!