Speed in Medium

Speed in Medium - break case 2...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 #include <iostream> #include <iomanip> using namespace std int main() { int x double distance cout << "Select your Medium" << endl cout << "1. Air" << endl << "2. Water" << endl << "3. Steel" << endl c cin >> x cout << "How far will the sound wave be traveling in feet?" << endl cin >> distance switch (x) { case 1: cout << "Air " << distance << fixed << setprecision(4) << " " << distance / 1100.0 << endl
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: break case 2: cout << "Water " << distance << fixed << setprecision(4) << " " << distance / 4900.0 << endl break case 3: cout << "Steel " << distance << fixed << setprecision(4) << " " << distance / 16400.0 << endl break default: cout << "Invalid input" << endl } return 0 }...
View Full Document

This note was uploaded on 04/14/2008 for the course CSI 1430 taught by Professor Aars during the Spring '08 term at Baylor.

Ask a homework question - tutors are online