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 GNU/Linux operating system comes with many built-in utilities for getting real work done. For example, imagine you had to an
natali 33 [55]

Answer:

Detailed solution is given below:

3 0
3 years ago
The Table Design and Layout tabs are available under the
maria [59]

Answer:

A-Table Tools

Explanation:

Layout tab. The Layout tab includes a selection tool for cells, rows, columns, and the entire table; tools to delete or insert rows and columns; tools

7 0
3 years ago
Read 2 more answers
_____ is a higher-level, object-oriented application interface used to access remote database servers
makkiz [27]
RDO.

RDO uses the lower-level DAO and ODBC for direct access to databases.
7 0
1 year ago
___operating space means there is a restriction to the drivers line of sight
Harman [31]

Answer

Closed zone operating space means there is a restriction to the drivers line of sight

Explanation

The line of sight restriction to a driver or while driving is the visible path of travel from your vehicle to your targeted area towards your destination.It is also the area that's visible to a driver while driving.

Closed zone or condition means that there is a restriction to the drivers view or that the space is unavailable in a particular zone.

5 0
3 years ago
Subscribe to my you tube channel to get all your questions answered
vredina [299]

kaaaaaaaaaaaaaaaaa

aaa

4 0
3 years ago
Other questions:
  • All phones must have a way of making and then terminating a connection to the phone network; however the exact procedure for doi
    6·1 answer
  • (Game Design) Which of the following is NOT a name of a popular digital sculpting application?
    13·1 answer
  • You have a workstation running windows vista business that you would like to upgrade to windows 7 ultimate. you want to perform
    11·1 answer
  • To add a row labeled "total" to a query design click the ____ button in the show/hide group on the design tab on the ribbon.
    14·2 answers
  • Suppose you have two tables: officer and gentleman. what question(s) can be asked by using the union operator?
    11·1 answer
  • Knowing and understanding the targeted audience is a main compnent to creating a website
    15·1 answer
  • N
    10·1 answer
  • What is containment and why is it part of the planning process
    8·1 answer
  • Your class requires you to use a program you must download on your computer. You have waited until day 5 of the week to download
    13·1 answer
  • E. Write an algorithm to show 'How to prepare a cucumber sandwich?". ​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!