This project allows users to perform fundamental binary operations using a simple C++ console application. Through this project, students will gain hands-on experience with binary arithmetic, 1's and 2's complement, and foundational C++ programming concepts.
- Convert decimal numbers to their binary representation.
- Calculate the 1's and 2's complement of a given binary number.
- Perform addition and subtraction on binary numbers.
- A C++ compiler (e.g., GCC, Clang, or MSVC)
- Clone the repository or download the source code.
- Navigate to the directory containing the source code.
- Compile the code:
g++ -o binary_calculator main.cpp
- Run the compiled program:
./binary_calculator
Upon running the program, you will be presented with a menu:
Binary Converter & Calculator
1. Convert Decimal to Binary
2. Find 1's and 2's Complement
3. Add two binary numbers
4. Subtract two binary numbers
Enter your choice:
- For options 1 and 2: Follow the on-screen prompts.
- For options 3 and 4: You'll be asked to enter two binary numbers one by one.
Through this project, students will:
- Understand the significance of binary representation in computing.
- Gain practical insights into the 1's and 2's complement systems and their importance.
- Get hands-on experience with C++ programming concepts like conditional statements, loops, functions, and basic I/O.
- Implement binary multiplication and division.
- Introduce error checks for invalid inputs.