Part 2 code below for part 2 Part 2 Remove the code for PrintBinary() from MyLib
ID: 3738964 • Letter: P
Question
Part 2
code below for part 2
Part 2 Remove the code for PrintBinary() from MyLib.c. Elim parameter to ConvertDecimalToBinary) to return the converted number in an array called outputArray. This Code6 xxxxxxxxxx.C case 1 should call ConvertDecimal ToBinary) and then Code6 xxxxxxx.c should print the returned output that inate PrintBinaryo from Myl.ib.c and MyLib.h. Add a item on your new menu in Code6 xxxxxxxxxx. c. Add a call to ConvertDecimalToBinary () in is in outputArray. Part 3 Create a new function called Sentencecleanup (in MyL?b. c. Be sure to add the prototype to your MyLib.h. This function will have one parameter that is an array that contains the output from this function. This function will prompt the user for at least two sentences separated by one of 3 delimiters P1. case 2 in your menu in Code6 xxxxxxxxxx.c will call SentenceCleanup() and then print the output. Here's what it looks like when executed. The input sentences are capitalized and 2 spaces are put in between each sentence and the original punctuation is retained.Explanation / Answer
Solution:
The method for Decimal to binary is given below:
You can replace printBinary and call this method.
The output will be in an array so loop through to display the binary number.
Function:
void DecimalToBinary(int muNumber) //Method head
{
int binArray[1000]; //This array will store the binary number
int k = 0;
while (myNumber > 0) {
binArray[i] = myNumber % 2;
myNumber = myNumber / 2;
k++;
}
//Displaying the binary number in the reverse order you have to print
for (int x = i - 1; x >= 0; x--)
cout << myNumber [x];
}
I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.