Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Big Data, Mining, And Analytics Components Of Strategic Decision Making

Authors: Stephan Kudyba

1st Edition

1466568704, 9781466568709

More Books

Students also viewed these Databases questions

Question

90 Basic budgeting and accounting concepts.

Answered: 1 week ago

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago