1. Binary System Conversion Write a program with a function that accepts two positive binary number in string and convert into decimal value; subsequently, add both numbers and output as a binary...



1. Binary System Conversion


Write a program with a function that accepts two positive binary number in string and convert into decimal value; subsequently, add both numbers and output as a binary string. Demonstrate 8 bits and 16 bits in length as inputs.


Hint:


See PCC-CS02-Week05-Binary.pdf for conversion rules.


use of Math pow function to raise to the power,



http://www.cplusplus.com/reference/cmath/(Links to an external site.)



2. (To be reused for #3) Implements Addition Algorithm


Write a program with a function that implements the Addition Algorithm with base 10 addition (refer to week1 PDF) we discussed during lecture and accept two positive integer string value and perform addition operation and outputs the result. (You might need to initialize Cm string with "0..0" depend on the size of m; alternatively, you can store the Cm in Char array with fix size which we will talk about it later)


// the example function prototype for addition function below where accepting two numbers and m as input; output the addition result as string type as return value


string addFunction(string numberA, string numberB, int m);



3. Implements Multiplication Algorithm


Write a program with a function that implements a Multiplication Algorithm based on Lab 2 Assignment ( example solution shown in this lab).

Apr 25, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions ยป

Submit New Assignment

Copy and Paste Your Assignment Here