Logo Search packages:      
Sourcecode: mathwar version File versions  Download package

gint operator_result ( gint  x1,
gint  x2,
operator_type  oper 
)

Determine what the result of the operation should be.

Parameters:
x1 Operand number one
x2 Operand number two
oper The operation to be performed
Returns:
The result of x1 oper x2

Definition at line 38 of file operators.c.

References ADDITION, MULTIPLICATION, and SUBTRACTION.

{
   gint result = 0.0;

   switch (oper)
      {
      case SUBTRACTION:
         result = x1 - x2;
         break;

      case ADDITION:
         result = x1 + x2;
         break;

      case MULTIPLICATION:
         result = x1 * x2;
         break;

      default:
         g_assert_not_reached ();
      }

   return result;
}


Generated by  Doxygen 1.6.0   Back to index