1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Nezavi [6.7K]
4 years ago
12

8.10 LAB: Convert to binary - functions Write a program that takes in a positive integer as input, and outputs a string of 1's a

nd 0's representing the integer in binary. For an integer x, the algorithm is: As long as x is greater than 0 Output x % 2 (remainder is either 0 or 1) x
Computers and Technology
1 answer:
Korvikt [17]4 years ago
3 0

Answer:

// This program is written in C++ programming language

// Comments are used for explanatory purpose

// Program starts here

#include <iostream>

#include <string>

using namespace std;

// Declare variables

int inputvar;

// Declare output variable as array

int outputvar[32];

// Set a counter for binary array

int i = 0;

while (inputvar > 0) {

// Divide inputvar by 2 and store remainder in outputvar

outputvar[i] = n % 2;

inputvar/=2;

i++; // increment i by 1

}

// End of division

// Prin resulting array in reverse order

for (int j = i - 1; j >= 0; j--) {

cout << outputvar[j];

}

return 0;

}

// End of Program

You might be interested in
The italic button is located on the
SashulF [63]
It is located on Mini Tool Bar 
6 0
3 years ago
Which statement is true?
Alexeev081 [22]

Answer:

Bjarne Stroustrop published the first reference guide for C++

Explanation:

Bjarne Stroustrop is a computer scientist who created the C++ programming language while working at the AT&T Bell laboratory. He also published the first reference guide for the programming language.

In October 1985, the book, The C++ Programming Language, was published. It describes the c++ programming language and was the only documentation and reference guide for the programming language at the time. Newer editions have since been published.

7 0
3 years ago
Read 2 more answers
In addition to telling you which programs are currently running, what other information does the task bar display
faust18 [17]

I've got task manager open right now; it shows you

  • Applications
  • Processes
  • Services
  • Performance
  • Networking
  • Users

(In that order)

6 0
3 years ago
One way bloggers decide how to present information is by understanding
PSYCHO15rus [73]

I would say strong use of multimedia.

4 0
3 years ago
Read 2 more answers
Eli needs to export files from his mailbox into a single file that is portable and can be backed up to removable media. Which fi
slava [35]

Answer:

PST

Resource:

This question has already been answered here: brainly.com/question/18415952

Explanation:

PST is the personal storage table, which is a file built by Microsoft to store data from outlook and other services too.  Really quick, this may or may not be an option that you are looking for but, what I would do in my opinion would be to use the PST and export it on a removable USB, since USBs are removeable media.

6 0
3 years ago
Other questions:
  • What does a data bar in a cell represents​
    12·2 answers
  • Tree diagrams are useful for
    12·1 answer
  • How would you define data science ?
    10·1 answer
  • Is USA TestPrep a test-taking site that won't let you access other windows without kicking you off?
    13·1 answer
  • American company Software Unlimited is planning to expand its operations to the Bangor Republic where the group is the primary u
    7·1 answer
  • What happens when a computer gets a virus?
    6·2 answers
  • Cómo se llaman los robots que se utilizan para la exploración espacial, en medicina, en la industria, en la agricultura, los que
    13·1 answer
  • second question today 25 POINTS: What is the formula to balance a lever when both effort and resistance are present?
    14·1 answer
  • In which situation is coauthoring of presentations primarily utilized?
    13·2 answers
  • WHICH PROGRAMMING LANGUAGES ARE THE BEST FOR PROGRAMMING?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!