In New York, earthquakes are primarily events we hear about rather than experience. The Richter scale for measuring earthquake intensity is logarithmic; a 5.0 earthquake is ten times as intense as a 4.0 earthquake. You'll be writing a program to compare earthquakes. If quake1 and quake2 have Richter values richter1 and richter2, then you can compute the relative magnitude and energy using these formulas:
Write the function prototyped here:
void compareQuakes(double richter1, double richter2,
double& relMagnitude, double& relEnergy);
Then use it in a program that lets the user input Richter values for two earthquakes and reports the relative magnitude and intensity. Here's some sample data for testing:
| Quake 1: Southern Alaska, 1964 Quake 2: San Francisco, 1906 |
8.5 8.3 |
Quake 1 was 1.58 times the magnitude of Quake 2 and released 1.97 times as much energy. |
| Quake 1: Northwest Iran, 1990 Quake 2: Central Mexico, 1985 |
7.7 8.1 |
Quake 1 was 0.40 times the magnitude of Quake 2 and released 0.26 times as much energy. |
| Quake 1: Shaanxi Province, China, 1556 Quake 2: Los Angeles, 1994 |
8.6 6.6 |
Quake 1 was 100 times the magnitude of Quake 2 and released 900 times as much energy. |
Create and print sample runs for the examples given.