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
Over [174]
3 years ago
5

Type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to

print two random integers between (and including) 0 and 9. End with a newline. Ex: 5 7 Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, after calling srand() once, do not call srand() again. (Notes)

Engineering
1 answer:
liq [111]3 years ago
4 0

Answer:

View Image

Explanation:

No number is really ever random. It all has a seed, which is an initial value for the 'random' number to be generated. The rand() function uses an equation to  generate its value, and all its 'random' value depend on the first number you plug in into your equation. The initial number you plug into your equation is what srand() do.

If you just call rand() alone without calling srand() then the generated numbers will automatically use srand(1) as a default seed. Using the same srand() value will always yield the same sequence of numbers.

To get a number between 0 and 9, take the modulus of it with 10 because modulus give you the remainder, so the number rand()%10 will never be equal to 10 or greater.

You might be interested in
Methane gas is 304 C with 4.5 tons of mass flow per hour to an uninsulated horizontal pipe with a diameter of 25 cm. It enters a
Arada [10]

Answer:

a) h_c = 0.1599 W/m^2-K

b) H_{loss} = 5.02 W

c) T_s = 302 K

d) \dot{Q} = 25.125 W

Explanation:

Non horizontal pipe diameter, d = 25 cm = 0.25 m

Radius, r = 0.25/2 = 0.125 m

Entry temperature, T₁ = 304 + 273 = 577 K

Exit temperature, T₂ = 284 + 273 = 557 K

Ambient temperature, T_a = 25^0 C = 298 K

Pipe length, L = 10 m

Area, A = 2πrL

A = 2π * 0.125 * 10

A = 7.855 m²

Mass flow rate,

\dot{ m} = 4.5 tons/hr\\\dot{m} = \frac{4.5*1000}{3600}  = 1.25 kg/sec

Rate of heat transfer,

\dot{Q} = \dot{m} c_p ( T_1 - T_2)\\\dot{Q} = 1.25 * 1.005 * (577 - 557)\\\dot{Q} = 25.125 W

a) To calculate the convection coefficient relationship for heat transfer by convection:

\dot{Q} = h_c A (T_1 - T_2)\\25.125 = h_c * 7.855 * (577 - 557)\\h_c = 0.1599 W/m^2 - K

Note that we cannot calculate the heat loss by the pipe to the environment without first calculating the surface temperature of the pipe.

c) The surface temperature of the pipe:

Smear coefficient of the pipe, k_c = 0.8

\dot{Q} = k_c A (T_s - T_a)\\25.125 = 0.8 * 7.855 * (T_s - 298)\\T_s = 302 K

b) Heat loss from the pipe to the environment:

H_{loss} = h_c A(T_s - T_a)\\H_{loss} = 0.1599 * 7.855( 302 - 298)\\H_{loss} = 5.02 W

d) The required fan control power is 25.125 W as calculated earlier above

5 0
3 years ago
thermal energy is being added to steam at 475.8 kPa and 75% quality. determine the amount of thermal energy to be added to creat
eduard

Answer:

q_{in} = 528.6\,\frac{kJ}{kg}

Explanation:

Let assume that heating process occurs at constant pressure, the phenomenon is modelled by the use of the First Law of Thermodynamics:

q_{in} = h_{g} - h_{mix}

The specific enthalpies are:

Liquid-Vapor Mixture:

h_{mix} = 2217.2\,\frac{kJ}{kg}

Saturated Vapor:

h_{g} = 2745.8\,\frac{kJ}{kg}

The thermal energy per unit mass required to heat the steam is:

q_{in} = 2745.8\,\frac{kJ}{kg} - 2217.2\,\frac{kJ}{kg}

q_{in} = 528.6\,\frac{kJ}{kg}

7 0
3 years ago
The east-west row planting orientation is preferred to maximize light absorption of
Katyanochek1 [597]

Answer: True

Explanation:

The east-west row planting orientation helps in the maximize the light absorption by plants which then brings about an efficient photosynthesis activity.

Also, it helps in the shading of weeds that can be found in the inter-row space. Also, it brings about an improvement on drop yield crop yield.

Therefore, the answer to the above is true.

8 0
3 years ago
Helpppp EDO segundo orden
jeka94
Can’t really see it it’s blurry

Sorry
7 0
3 years ago
A O.1m³ rigid tank contains steam initially as 500k pa and 200°C. The steam is now allowed to cool until the temperature drops t
Aleksandr-060686 [28]

Answer:

Check it out here

Explanation:

7 0
2 years ago
Other questions:
  • A thin‐walled tube with a diameter of 12 mm and length of 25 m is used to carry exhaust gas from a smoke stack to the laboratory
    10·1 answer
  • Which of the following ranges depicts the 2% tolerance range to the full 9 digits provided?
    6·1 answer
  • A long, cylindrical, electrical heating element of diameter 10 mm, thermal conductivity 240 W/m·K, density 2700 kg/m3, and speci
    10·1 answer
  • (1) Estimate the specific volume in cm3 /g for carbon dioxide at 310 K and (a) 8 bar (b) 75 bar by the virial equation and compa
    10·1 answer
  • A 35 ft long solid steel rod is subjected to a load of 8,000 lb. This load causes the rod to stretch 0.266 in. The modulus of el
    9·1 answer
  • For many people in 3D modeling copyrights and licensing allow them to earn a living.
    12·1 answer
  • 3. This material is considered flammable.
    11·2 answers
  • Depending on the model, all-electric vehicles can go about _______ miles on a single charge.
    6·1 answer
  • You want to see both Michael and Meet Wally Sparks. If you purchase tickets for both
    7·1 answer
  • Military glorification through mosaics, relief carvings and triumphant arches are often associated with?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!