Question: Answer in C++ See the attached question below 5. (a) Write a procedure void print(const vector & v) for printing a vector of bools. Do

Answer in C++

See the attached question below

Answer in C++ See the attached question below 5. (a) Write a

5. (a) Write a procedure void print(const vector& v) for printing a vector of bools. Do not use boolalpha. In this question, we'll have them being Os and 1s. Therefore, you do not need to separate the bools by spaces (b) Write a procedure void addZeros (vector& v, size_t numberToAdd) which adds Os to a vector v. (c) Write a function vector addition(vector v, vector w) Its goal is to do binary addition, but for convenience we'll read from LOWEST BIT TO HIGHEST BIT (THE OPPOSITE OF USUAL). So 2 is 01, 8 is 0001, and their sum should be 10 which is 0101. . 10 is 0101, 8 is 0001, and their sum should be 18 which is 01001. You should not need to convert into decimals. Instead, implement addition with carrying The examples above are done as follows. We also provide a third example Addition with carrying: 01010 + 00010 0100 110011000100 + 111001010110 +0001 0101 01001 010110110001 Carry: (d) The output of a main () function saying: vector b1 -11,1,0,0,1,1,0,0,0,1J; vector b2 -11,1,1,0,0,1,0,1,0,1,1J; vector b3 - addition(b1,b2); print(b3); Should be 010110110001

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!