Source-1.cpp - #include #include #include...

This preview shows 1 out of 2 pages.

#include <iostream> #include <string> #include <iomanip> using namespace std; /* Eric Theil CMPSC 201-1 After choosing one of the four different gases given (Carbon Dioxide, Air, Helium, Hydrogen), program to calculate how far away (in meters) the sound was heard from the starting location. */ int main() { double const SPEED_OF_CARBON_DIOXIDE = 258.0; double const SPEED_OF_AIR = 331.5; double const SPEED_OF_HELIUM = 972.0; double const SPEED_OF_HYDROGEN = 1270.0; char input =' '; double time; int sig_figs = 8; double distance = 0; cout << "Please enter carbon dioxide (A), air (B), helium (C), or hydrogen (D): "; cin >> input; cout << "Please enter the time it took for the sound to travel through the medium: " ; cin >> time; if (time > 31 || time < 0)
Image of page 1

Subscribe to view the full document.

Image of page 2
You've reached the end of this preview.
  • Fall '10
  • staff
  • double Time, double distance

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern