2nd unit test - cin >> m1...

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

View Full Document Right Arrow Icon
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 }
Background image of page 1

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

View Full DocumentRight Arrow Icon
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
Background image of page 2
Background image of page 3
This is the end of the preview. Sign up to access the rest of the document.

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

Page1 / 3

2nd unit test - cin &amp;amp;gt;&amp;amp;gt; m1...

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