(Practice) For the following correct algebraic expressions and corresponding incorrect C++ expressions, find the errors and write corrected C++ expressions:
Algebra C++ Expression
b.
c.
d.
e.
Want to see the full answer?
Check out a sample textbook solutionChapter 2 Solutions
C++ for Engineers and Scientists
- (Practice) Determine the values of the following integer expressions: a.3+46f.202/( 6+3)b.34/6+6g.( 202)/6+3c.23/128/4h.( 202)/( 6+3)d.10( 1+73)i.5020e.202/6+3j.( 10+3)4arrow_forward(General math) The volume of oil stored in an underground 200-foot deep cylindrical tank is determined by measuring the distance from the top of the tank to the surface of the oil. Knowing this distance and the radius of the tank, the volume of oil in the tank can be determined by using this formula: volume=radius2(200distance) Using this information, write, compile, and run a C++ program that accepts the radius and distance measurements, calculates the volume of oil in the tank, and displays the two input values and the calculated volume. Verify the results of your program by doing a hand calculation using the following test data: radius=10feetanddistance=12feet.arrow_forward(Physics) a. Design, write, compile, and run a C++ program to calculate the elapsed time it takes to make a 183.67-mile trip. This is the formula for computing elapsed time: elapsedtime=totaldistance/averagespeed The average speed during the trip is 58 mph. b. Manually check the values computed by your program. After verifying that your program is working correctly, modify it to determine the elapsed time it takes to make a 372-mile trip at an average speed of 67 mph.arrow_forward
- (Practice) State whether the following variable names are valid. If they are invalid, state the reason. prod_a c1234 abcd _c3 12345 newamp watts $total new$al a1b2c3d4 9ab6 sum.of average volts1 finvoltarrow_forward(General math) a. Design, write, compile, and run a C++ program to calculate the volume of a sphere with a radius, r, of 2 in. The volume is given by this formula: Volume=4r33 b. Manually check the values computed by your program. After verifying that your program is working correctly, modify it to determine the volume of a cube with a radius of 1.67 in.arrow_forwardMy v and d are incorrect, please write the equations correctly.arrow_forward
- (General math) a. Design, write, compile, and run a C++ program that calculates and displays the area of a triangle, such as the one in Figure 2.18, with a base of 1 in and a height of 1.5 in. The area is given by this formula: Area=12(base)(height) b. Manually check the values computed by your program. After verifying that your program is working correctly, modify it to determine the area of a two-dimensional triangle with a base of 3.5 in and a height of 1.45 in.arrow_forwardProvide the code of the function in C++arrow_forward(Physics) a. The weight of an object on Earth is a measurement of the downward force onth e object caused by Earth’s gravity. The formula for this force is determined by using Newton’s Second Law: F=MAeFistheobjectsweight.Mistheobjectsmass.AeistheaccelerationcausedbyEarthsgravity( 32.2ft/se c 2 =9.82m/ s 2 ). Given this information, design, write, compile, and run a C++ program to calculate the weight in lbf of a person having a mass of 4 lbm. Verify the result produced by your program with a hand calculation. b. After verifying that your program is working correctly, use it to determine the weight, on Earth, of a person having a mass of 3.2 lbm.arrow_forward
- Code and test the given function in C++.arrow_forward4. Look up the Pythagorean theorem if you are not already familiar with it. Use the following formula to solve for c in the formula: c = √a2 + b2. Use the proper functions from the cmath header file. Be sure to output the result..arrow_forward(Electrical eng.) a. Write, compile, and run a C++ program that calculates and displays the value of the current flowing through an RC circuit (see Figure 3.19). The circuit consists of a battery connected in a series to a switch, a resistor, and a capacitor. When the switch is closed, the current, i, flowing through the circuit is given by this formula: i=(EIR)et/RC Eisthevoltageofthebatteryinvolts.Risthevalueoftheresistorinohms.Cisthevalueofthecapacitorinfarads.tisthetimeinsecondsaftertheswitchisclosed.eisEulersnumber,whichis2.71828( roundedtofivedecimalplaces). Using this formula, write, compile, and run a C++ program to determine the voltage across the capacitor shown in Figure 3.19 when t is 0.31 seconds. (Note: The value of RC is referred to as the system’s time constant.) The program should prompt the user to enter appropriate values and use input statements to accept the data. In constructing the prompts, use statements such as “Enter the voltage of the battery.” Verify your program’s operation by calculating by hand the current for the following test data: Testdataset1:Voltage=20volts,R=10ohms,RC=0.044,t=0.023secondsTestdataset2:Voltage=35volts,R=10ohms,RC=0.16,t=0.067seconds b. Check the value computed by your program by hand. After verifying that your program is working correctly, use it to complete the following chart:arrow_forward
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr