/***************************************************
F = m a Program

Write a program that solves for the unknown variable
in the F = m a equation.  The user enters two
variable = value pairs (e.g "m = 10.0 F = 3.5") and
the program writes the unknown variable and its
value ("a = .35" in our example).

***************************************************/
#include <iostream>
using namespace std;

int main()
{

  cout << "The F = m a Program" << endl;

  // Read first variable/value pair
  char var1,c;
  double val1;
  cout << "Enter <var> = <value> : ";
  cin >> var1 >> c >> val1;

  // Read second variable/value pair
  char var2;
  double val2;
  cout << "Enter <var> = <value> : ";
  cin >> var2 >> c >> val2;

  // Decide which variable is missing & solve
  if (var1 == 'F')
  {   // var1 is F
    if (var2 == 'm')
      cout << "a = " << val1 / val2 << endl;
    else
      cout << "m = " << val1 / val2 << endl;
  }
  else
  {
    if (var1 == 'm')
    {  // var1 is m
      if (var2 == 'a')
	cout << "F = " << val1 * val2 << endl;
      else
	cout << "a = " << val2 / val1 << endl;
    }
    else
    {  // var1 is a
      if (var2 == 'm')
	cout << "F = " << val1 * val2 << endl;
      else
	cout << "m = " << val2 / val1 << endl;
    }
  }
 
 return 0;
}