Unit 02 Test - UNIT02TEST

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
UNIT 02 TEST 1. Write a C++ program that finds E using the formula: ( E ) / ( 2 * G ) = ( 1 +  Nu ) where E and G are the Young's Modulus and the Shear Modulus of steel.  Determine the value of Nu (Poisson's ratio) by querying the user. (Note: The  shear modulus of steel is approximately 80e9 N/m^2, where e9 means 10 to  the power of 9). #include <iostream>  #include <cmath> #define GSM 80*10e9 using namespace std; int main (void) { float fNu = 0.0; float fE = 0.0; cout << "Please enter the value of Nu (Poisson's ratio): " << endl; cin >> fNu; fE = (1+fNu)*(GSM*2); cout << "Your Young's Modulus (E) value is: " << fE << endl; return 1; } 2. Scan through the following C++ code and spot the errors in the code. Turn  in the corrected code with a comment //FOUND at the end of each line which  had an error. //Program to convert mph to kph #include using namespace s Main { float mph, kph;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
cout >> "Please input the speed in miles per hour" cin >> mph; kph = mph * 1.609; cout << mph << "miles per hour is" << kph << "km per hour" return; } You muist submit a corrected working version of this code to receive credit. #include <iostream> // missing <iostream>
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

Unit 02 Test - UNIT02TEST

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online