/*******************************************************************************
* Aiden Stannard // CS1A // Chapter 4 Homework: Challange 19# // 9/26/2026
*
* Distance Traveled Through Gases
*
* This program recieves an selection from a menu itemized by different gases
* and than receives the time it took for sound to travel through the selected
* gas, outputing the distance the sound traveled.
*
* Inputs:
* 1)CO2
* 2)Air
* 3)Helium
* 4)Hydrogen
*
* Select the number corrosponding to the medium that you are measuring ___
* Now enter the time in seconds it took for the sound to travel ___
*
* Output: The sound traveled ___ Meters
******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
int menuSelect;
float seconds;
cout << "1)CO2\n" << "2)Air\n" << "3)Helium\n" "4)Hydrogen" << endl;
cout << "\nSelect the number corrosponding to the medium that you are "
"measuring" << endl;
cout << "Now enter the time in seconds it took for the sound to travel\n";
cin >> menuSelect;
cin >> seconds;
if (menuSelect == 1)
cout << "The sound traveled " << seconds * 258.0 << " Meters" << endl;
else if (menuSelect == 2)
cout << "The sound traveled " << seconds * 331.5 << " Meters" << endl;
else if (menuSelect == 3)
cout << "The sound traveled " << seconds * 972.0 << " Meters" << endl;
else if (menuSelect == 4)
cout << "The sound traveled " << seconds * 1270.0 << " Meters" << endl;
else
cout << menuSelect << " Is not a valid selection. Try Again." << endl;
return 0;
}