Homework 6 11-19-09 river project part 1

Homework 6 11-19-09 river project part 1 - { dx = dy *...

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

View Full Document Right Arrow Icon
Alex Fidalgo 11/19/09 Intro to Programming E-115-C, E-115-LK I pledge that I have abided by the Stevens Honor System. _________________________ #include <iostream> #include <cmath> #include <string> using namespace std; int main() { float Ddown, Wriver, Vrow, Vwater, Dwaterfall, dx, dy, x, y, nsteps; char go; do { cout << "Enter river width: " ; cin >> Wriver; cout << "Enter river velocity: " ; cin >> Vwater; cout << "Enter rower velocity: " ; cin >> Vrow; cout << "Enter distance to waterfall: " ; cin >> Dwaterfall; cout << "Enter number of steps taken across the river: " ; cin >> nsteps; dy = Wriver/nsteps; x = 0; y = 0; while
Background image of page 1

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

View Full DocumentRight Arrow Icon
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: { dx = dy * (Vwater/Vrow); y = y + dy; x = x + dx; cout &lt;&lt; &quot;Your coordinate is: &quot; &lt;&lt; x &lt;&lt; &quot; , &quot; &lt;&lt; y &lt;&lt; endl; } cout &lt;&lt; &quot;Your distance down the river is: &quot; &lt;&lt; x &lt;&lt; &quot; meters&quot; &lt;&lt; endl &lt;&lt; endl; if (y &lt; Wriver &amp;&amp; x &lt; Dwaterfall) cout &lt;&lt; &quot;Hooray, you live! &quot; &lt;&lt; endl; else cout &lt;&lt; &quot;Way to go, now you're dead.&quot; &lt;&lt; endl; cout &lt;&lt; endl &lt;&lt; &quot;Do you wish to row again? (y/n) &quot; ; cin &gt;&gt; go; } while ((go == 'y' ) || (go == 'Y' )); return 0; } This is when the program successfully built after completely part C of the assignment. This is the program running successfully....
View Full Document

Page1 / 3

Homework 6 11-19-09 river project part 1 - { dx = dy *...

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