/* halfadder8.cpp calculates the outputs from boolean expressions that
 * represent the logical circuit for a binary half-adder.
 *
 *  Input (keyboard): two binary digits
 *  Output (screen):  two binary values representing the sum and carry
 *                    that result when the input values are added
 ***********************************************************************/

#include <iostream.h>                         // cout, cin, <<, >>

int main()
{
   cout << "Enter two binary inputs: ";
   short digit1, digit2;                      // the two binary inputs
   cin >> digit1 >> digit2;
                                              // the two circuit outputs
   bool sum = (digit1 || digit2) && !(digit1 && digit2),    
        carry = (digit1 && digit2);

   cout << "Carry = " << carry << " Sum = " << sum << "\n\n";

   return 0;
}




