2nd unit test

# 2nd unit test - cin>> m1 if(m1<=0...

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

Sheet1 Page 1 #include <iostream> using namespace std int main(void) { float inch = 0 float cent= 0 cout << "Please input the length in centimeters " << endl cout >> cent inch = cent/2.54 cout << "centimeters is equal to" << inch << "inches"<< endl return 0 } #include <iostream> using namespace std int main(void) { double x cout <<"Please input a value for n" << endl cin >> x double nFormula = (x*(x-1))/2 cout <<"The solution to the formuala is: "<< nFormula << endl return 0 } #include <iostream> using namespace std int main(void) { enum day {Newyrs = 1, Indday, Halloween, Thanksgiving, Christmas,} day myFaveDay = Christmas cout << myFaveDay << endl return 1 }

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

View Full Document
Sheet1 Page 2 #include <iostream> #define x -.7596879129 #define g 9.8 using namespace std int main(void) { double mu1 double mu2 double m1 double m2 cout <<"Please enter the coefficient of static friction."<< endl cin >> mu1 if(mu1<=0) { cout <<"Invalid inputs, exiting. .."<< endl return 0 } cout <<"Now, please enter the mass." <<endl
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: cin >> m1 if(m1<=0) { cout <<"Invalid inputs, exiting. .."<< endl return 0 } double fFriction = mu1*m1*g*x cout <<"The force of friction is: " << fFriction << endl cout <<"Now please enter a second coefficient of static friction."<< endl cin >> mu2 if(mu2<=0) { cout <<"Invalid inputs, exiting. .."<< endl return 0 } cout <<"And please enter a second mass."<< endl cin >> m2 if(m2<=0) Sheet1 Page 3 { cout <<"Invalid inputs, exiting. .."<< endl return 0 } double f2Friction = mu2*m2*g*x cout <<"The force of friction for the second scenario is: "<< f2Friction <<endl if(fFriction==f2Friction) { cout<<"The forces of friction for both scenarios are the same." << endl } if(fFriction<f2Friction) { cout<<"The force of friction for the first scenario is larger." << endl } if(fFriction>f2Friction) { cout<<"The force of friction for the second scenario is larger."<< endl } }...
View Full Document

{[ snackBarMessage ]}

### Page1 / 3

2nd unit test - cin>> m1 if(m1<=0...

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

View Full Document
Ask a homework question - tutors are online