Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include using namespace std; void dectobin(int*, int); int bintodec(int*, int); int n; int main() { int a, b, sc, ssor, send, s1, c, sum,

image text in transcribed#include #include using namespace std; void dectobin(int*, int); int bintodec(int*, int); int n; int main() { int a, b, sc, ssor, send, s1, c, sum, allz, rem, quo; char ch; start: cout > a; cout > b; if (a != 0 && b == 0) cout 0) { a = abs(a); b *= -1; } double td; td = log((double)abs(a)) / log(2.0); n = (int)ceil(td + 1); //Finding out the number of digits required tostore both dividend and divisor in binary format cout = 0; i--) //Taking the 2's Complement of M1 andstoring it as M2 { if (M1[i] == 0) M2[i] = 0; else break; } M2[i--] = 1; while (i >= 0) M2[i] = !M1[i--]; cout

} } void dectobin(int *arr, int num) //Function to convert the passeddecimal number into binary and return the base address of thebinary array { int neg, i = 0, j, temp; if (num= 1; i--) //Taking 2's Complement to store thenegative number if (*(arr + i) == 1) break; i--; while (i >= 1) *(arr + i) = !*(arr + i--); } } int bintodec(int *p, int y) //Function to convert a binary array todecimal by taking its base address as input and returning thedecimal equivalent { int sum = 0, i; if (*p == 1) //Taking 2's Complement of the negative number toget back its original magnitude { for (i = n - 1; i >= 1; i--) if (*(p + i) == 1) break; i--; while (i >= 1) *(p + i) = !*(p + i--); } for (i = 1; i

I got this code and i need help correcting it's errors. Thank you.

arted: Project: Binary_Divisor, Configuration: Debug Win32 cpp desktop\c++ programs\binary_divisor binary_divisor\binary_ divisor.cpp(38): error C2131: expression did not evaluate to a constant desktoplc++ programs\binary_divisor\binary_divisor\binary divisor.cpp (38): note: failure was caused by non-constant arguments or reference to a non-constant symbol desktoplctt programs\binary_divisor\binary divisor binary_divisor.cpp (38) not: see usage of 'n desktoplc++ programs\binary_divisor\binary_divisor\binary_divisor.cpp (42): warning C4552: result of expression not used desktoplc++ programs\binary_divisor\binary_divisor\binary_divisor.cpp (47): warning C4552: "

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Database Management

Authors: Fred R. McFadden, Jeffrey Slater, Mary B. Prescott

5th Edition

0805360549, 978-0805360547

More Books

Students also viewed these Databases questions

Question

How would you assess the value of an approach like this?

Answered: 1 week ago