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]
3 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]3 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
Write the definition of a function named timeOnHighway that receives three parameters, all of type double: mileEndingPoint , mil
dybincka [34]

Answer:double timeOnHighway (double mileEndingPoint, double mileStartingPoint = 0.0, double speed = 55.0)

return (mileEndingPoint - mileStartingPoint) / speed

Explanation:

6 0
3 years ago
Which three staements about gravity and the formation of the solar system are true?
Yuliya22 [10]

Answer:Gravity held the pieces of forming planets together. Gravity pulled most of the matter into the center of the solar system Gravity caused the planets and Sun to have spherical shapes.​

Explanation:

7 0
3 years ago
The ArrayList class ____ method returns the current ArrayList size.
timurjin [86]

Answer:

b. size

Explanation:

We can use the size() method of java.util.ArrayList to determine the size of an  ArrayList in Java. The size() method of the ArrayList class returns an integer which is equal to the number of elements present in the ArrayList.

Below is an example code to illustrate the use of the size() method of the ArrayList:-

     ArrayList<Integer> aList = new ArrayList<Integer>(5);

      aList.add(25);

     aList.add(2);

     aList.add(5);

     aList.add(22);

     System.out.println("Size of the array list: " + aList.size());

This will print the size of the array list as 4 since we've added four numbers into the array list.

3 0
4 years ago
Write one for loop to print out each element of the list several things. then write another for loop
Kay [80]

Question:

Write one for loop to print out each element of the list several_things. Then, write another for loop to print out the TYPE of each element of the list several_things.

Answer:

The solution in python is as follows:

for element in several_things:

    print(element)

   

for element in several_things:

    print(type(element))

Explanation:

The solution assumes that the list several_things has already been initialized.

So, the rest of the code is explained as follows:

This line iterates through the list, several_things

for element in several_things:

This line prints each element

    print(element)

This line iterates through the list, several_things for the second time    

for element in several_things:

This line prints the type of each element

    print(type(element))

6 0
3 years ago
For problems 14 – 21 determine all the roots of the given function.
lesya [120]
What’s the problem ?
7 0
3 years ago
Read 2 more answers
Other questions:
  • An incorrectly spelled word is indicated by _______. a. a red checkmark beside the word b. the word higlighted in yellow c. a re
    8·2 answers
  • Sam wants to move across the text and his documents to add data at predefined stops. Which key will Hughes to navigate through t
    6·1 answer
  • Which tab should gemima use to open the formula dialog box
    13·2 answers
  • What is the determining criterion for removing older transactions from a company file
    9·1 answer
  • Q13. On which option do you click to
    12·1 answer
  • A(n) _____ is a network connection device that can build tables that identify addresses on each network.
    10·1 answer
  • Consider a short, 90-meter link, over which a sender can transmit at a rate of 420 bits/sec in both directions. Suppose that pac
    9·1 answer
  • Which IDEs support multiple high-level programming languages? Select all that apply.
    13·1 answer
  • Which of the following bit value represent -5 in two's complement notation?
    5·1 answer
  • Pleaseee helpppppppppp
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!