Write a program that prompts the user to enter the two


Project: Elementary Aspects of C++

a. Modulo Division Write a program to read in a 3-digit integer and print out the sum of the digits of the integer. Use the % operator to extrct the digits and use the / operator to extract the digit.

b. Approximating Pi: Pi can be computed using the formula 4 * (1.0 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13 - . . .)

Write a program to display the result of 4 * (1.0 - 1/3 + 1/5 - 1/7 + 1/9 - 1/11 + 1/13)

Note: be sure to use 1.0 not 1 in your program.

c. Wind Chill The National Weather Service has a relatively new formula to measure the wind chill temperature. The formula is

Wind Chill = 35.74 + 0.6215 T - 35.75 V0.16 + 0.4275TV0.16

Where T = outside temperature (°F) and V = wind velocity (mph). The formula cannot be used for wind speeds below 2 mph, temperatures below -58°F, or temperatures above 41°F.

Write a program that prompts the user to enter a temperature and a wind speed, and then displays the wind chill temperature. You may assume the values entered are valid.

Enter temperature (Fahrenheit): 5.3
Enter wind speed (mph): 6
The wind chill index is -5

d. Distance Given the two points (x1, y1) and (x2, y2), the distance between these points is given by the formula:

d= √[(x2-x1)2+(y2-y1)2]

Write a program that prompts the user to enter the two points, and then displays the distance between them. You may assume the values entered are valid.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Write a program that prompts the user to enter the two
Reference No:- TGS01269931

Now Priced at $30 (50% Discount)

Recommended (99%)

Rated (4.3/5)