Question: C++ Need help to convert large decimal to binary in the program without using arrays/functions. When enter more than 4 digits, it doesn't work. #include

C++ Need help to convert large decimal to binary in the program without using arrays/functions. When enter more than 4 digits, it doesn't work.

#include using namespace std;

int main() { float decimal, binary = 0, multiply = 1, remainder;

cout << "Enter decimal number: "; cin >> decimal; cout << "The binary representation of " << decimal ; { while (decimal > 0) { remainder = decimal % 2; binary = binary + ( remainder * multiply ); multiply = multiply * 10; decimal = decimal / 2; } } cout <<" is " << binary << endl; return 0; }

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!