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
jeka94
3 years ago
7

In this case we will do automated testing against your program. In order to do this you will prompt (ask for input) for a random

seed and use it to seed your random number generator. This will allow you to test your program against several seeds. And we will test your program with a series of these random seeds. And this will not be your entire grade, but your ability to pass these tests is a part of your grade. This is a common industry practice and one we will try to introduce you.
Engineering
1 answer:
tester [92]3 years ago
8 0

Answer:

C++ code is given below with appropriate comments

Explanation:

#include<iostream>

#include<cstdlib>

using namespace std;

// takes in the horses int array and its size

// for each horse perform a toss

void toss(int horses[],int horse_count){

               

               for(int i=0; i<horse_count;i++){

                               // if the toss result is 1 we advance the horse

                               // if the result is zero we dont advance                  

                               bool advance= rand()%2==1;

                               if(advance)horses[i]++;

               }

}

//takes in the horses int array and its size

// returns true if there is a winner

// else returns false

bool isWinner(int horses[], int horse_count){

               

               for(int i=0; i<horse_count;i++){

                               if(horses[i]>=15){

                                               cout<<"Horse "<<i<<" wins!"<<endl;      

                                               return true;

                               }

                               

               }

               return false;

}

// takes in the horses int array and its size

// prints the horses with the track

int print(int horses[], int horse_count){

               

               

               for(int i=0;i<horse_count;i++){

                               

                               for(int track=1; track<horses[i];track++)cout<<".";

                               cout<<i;

                               for(int track=horses[i]+1;track<=15;track++)cout<<".";

                               cout<<endl;      

               }

               

               cout<<endl;

               cout<<endl;

}

int main(){

               

               unsigned int seed;

               cout<<"Please enter a random seed: ";cin>>seed;

               srand(seed);

               

               const int HORSES_COUNT=5;

               // we have taken an int array

             // the numbers are all set to 1

            // if the toss turns 1 we increment the value for that horse by 1

            // we keep on incrementing until the number is 15

               int horses[HORSES_COUNT]{1};

               

               // repeat the loop until there is a winner

               while(!isWinner(horses,HORSES_COUNT)){

                               toss(horses,HORSES_COUNT);

                               print(horses,HORSES_COUNT);

               }

               

}

You might be interested in
What is the hardest part of engineering?
Vikki [24]

ANSWER:

Aerospace Engineering. ...

Chemical Engineering. ...

Biomedical Engineering.

EXPLANATION:

This is all i know but ... I hope this helps~

7 0
2 years ago
Hi,I want to know something.
Paha777 [63]

Answer:

So it looks to me that, Yes, you can find 10-50 leds on Amazon. You just have to be specific and search 10-50 led Christmas lights for windows, or something along those lines. Also try filtering the results, and reading the descriptions and reviews. This should help you out, and if it doesn't then I'm sorry.

Good luck friend :)

8 0
3 years ago
Let r be a bank's interest rate in percent per year (APR). An initial amount of money P, also called as principal, will mature t
Liono4ka [1.6K]

Answer:

See explanation below.

Explanation:

For this case the program needs to take the inputs as P,r and n and the output would be as A and printed on the system. The code is:

# Inputs

P = float(input("Enter the present value : "))  

r = float(input("Enter your APR : "))  

n = float(input("Enter the number of years : ") )

# Output

A = P*(1 +(r/100))**n

print("The future values is:", A)  

And the result obtained is:

Enter the present value : 1000

Enter your APR : 0.95

Enter the number of years : 5

The future values is: 1048.4111145526908

7 0
3 years ago
A load of 1 kg is applied to the tip of a cantilever beam with a width b = 2.5 cm, a thickness h = 1 mm, length L = 20 cm, modul
garik1379 [7]

Answer:

20 g/cm3 divide by 6 is 20

4 0
3 years ago
Read 2 more answers
What does the simplify command do
uranmaximum [27]

Answer:The simplify command is used to apply simplification rules to an expression. The simplify routine searches the expression for function calls, square roots, radicals, and powers and invokes the appropriate simplification procedures. For detailed information on the simplify command, see simplify/details.

Explanation:

4 0
3 years ago
Other questions:
  • Is CO, an air pollutant? How does it differ from other emissions resulting from the combustion of fossil fuels?
    7·1 answer
  • Select the correct answer.
    5·1 answer
  • The shear force diagram is always the slope of the bending moment diagram. a)True b)- False
    14·1 answer
  • All welding processes that take place without melting of the work pieces. a)- True b)-False
    15·1 answer
  • You are designing a geartrain with three spur gears: one input gear, one idler gear,and one output gear. The diametral pitch for
    13·1 answer
  • . (20 pts) A horizontal cylindrical pipe (k = 10 W/m·K) has an outer diameter of 15 cm and a wall thickness of 5 cm. The pipe is
    14·1 answer
  • The website of a bank that an organization does business with has been reported as untrusted by the organization's web browser.
    12·1 answer
  • Which step in the engineering design phase is requiring concussion prevention from blows up to 40 mph an example of?
    6·1 answer
  • What is the relationship between compressor work and COPR?
    14·1 answer
  • In a medical lab, Sandrine is working to isolate one element from a sample of liquid material. She uses a centrifuge, a machine
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!