Question: C++ functions and main functions. Ty 2-1. Given a positive decimal number, write a function that transforms it into binary, and prints out the result.

 C++ functions and main functions. Ty 2-1. Given a positive decimal

C++ functions and main functions. Ty

2-1. Given a positive decimal number, write a function that transforms it into binary, and prints out the result. You may assume that the string contains at least 1 and no more than 9 decimal digits. The output should only include the binary digits followed by a new line. Signature: void print_as_binary (std::string decimal_number) 2-2. Given a binary number represented as an array, write a function that takes the array and its size as a parameter, and returns the integer value. You may assume that there are at least 1 and no more than 30 numbers in the array and that all the values are either 0 or 1. The array is ordered with most significant binary digit at the start (index 0) and the least significant digit at the end. signature: int binary_ to_number(int binary_digits[], int number_of_digits) Definition: a palindrome is a sequence that reads the same backwards as forwards. Hence, 101, 120021 and 1 are all numerical palindromes. A palindrome array would be of the form [1,2,2,1] for example. An empty array is a palindrome by definition

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!