Skip to content

Latest commit

 

History

History
58 lines (40 loc) · 1.65 KB

File metadata and controls

58 lines (40 loc) · 1.65 KB

Binary Converter & Calculator

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.

Features

  • 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.

Getting Started

Prerequisites

  • A C++ compiler (e.g., GCC, Clang, or MSVC)

Compilation and Execution

  1. Clone the repository or download the source code.
  2. Navigate to the directory containing the source code.
  3. Compile the code:
    g++ -o binary_calculator main.cpp
    
  4. Run the compiled program:
    ./binary_calculator
    

Usage

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.

Learning Objectives

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.

Future Enhancements

  • Implement binary multiplication and division.
  • Introduce error checks for invalid inputs.