Click to See Complete Forum and Search --> : calculator using booleans
supahamster
June 10th, 2009, 02:57 PM
I want to undertake a project for my own learning. What I want to do is to make a calculator (I'm using VC++ 2008 by the way) that will use booleans to do the calculations (to 'simulate' bits in an actual calculator or computer, or whatever). Yes, I know that c++ has built-in functions and headers to do math, but I want to do it myself. Can anyone refer me to a resource where I could find how such calculations are done? I can currently multiply by powers of 2 by shifting bits (or booleans in this case), but I don't know how I would do any other operations.
Thanks
olivthill2
June 11th, 2009, 06:47 AM
Google with "boolean algebra" will bring you interesting pages, such as http://en.wikipedia.org/wiki/Boolean_algebra_(introduction) http://www.allaboutcircuits.com/vol_4/chpt_7/2.html
wigga
June 11th, 2009, 07:09 AM
note booleans are in constraint of C++ rules.
booleans are always 1 or 0 true or false.
so you cannot multiply a boolean.
You are saying you have 2 bit sets and you want to perform calcultaions on them
Zachm
June 11th, 2009, 07:41 AM
Judging from your post, you probably want to implement binary number multiplication (http://en.wikipedia.org/wiki/Multiplication_algorithm),
addition (http://chortle.ccsu.edu/AssemblyTutorial/Chapter-08/ass08_3.html), and so on (subtraction, division).
Regards,
Zachm
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.