Homework 6 11-19-09 river project part 1

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

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

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

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

View Full Document
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 << "Your coordinate is: " << x << " , " << y << endl; } cout << "Your distance down the river is: " << x << " meters" << endl << endl; if (y < Wriver && x < Dwaterfall) cout << "Hooray, you live! " << endl; else cout << "Way to go, now you're dead." << endl; cout << endl << "Do you wish to row again? (y/n) " ; cin >> 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

{[ snackBarMessage ]}

Page1 / 3

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

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

View Full Document
Ask a homework question - tutors are online