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]
3 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]3 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 diagnostic test that involves watching a computer monitor with alternating checkerboard patterns while an eeg is performed i
kolezko [41]

Answer:

VER.

Explanation:

The diagnostic test that involves watching a computer monitor with alternating checkerboard patterns while an ecg is performed is known as a​ VER.

6 0
3 years ago
Read 2 more answers
Which type of cable is described as a central conductor wire that is surrounded by insulating materials and placed inside a brai
Elan Coil [88]
<span>Which type of cable is described as a central conductor wire that is surrounded by insulating materials and placed inside a braided metal shield? A coaxial cable.</span>
3 0
3 years ago
In today's society, unethical actions are: A) Easier than ever to get away with, because the general public and insurers are les
ra1l [238]
B I think is the best answer
7 0
3 years ago
Read 2 more answers
Jacob is a website designer. Whenever his company takes on a new project, Jacob takes the initiative and comes up with ideas and
Troyanec [42]
Eating a potato is what hes using
3 0
3 years ago
Data_____is defined as the condition in which all of the data in the database are consistent with the real-world events and cond
mezya [45]

Answer:

d. integrity

Explanation:

Data integrity is defined as the condition in which all of the data in the database are consistent with the real-world events and conditions.

Data integrity can be used to describe a state, a process or a function – and is often used as a proxy for “data quality”. Data with “integrity” is said to have a complete or whole structure. Data integrity is imposed within a database when it is designed and is authenticated through the ongoing use of error checking and validation routines. As a simple example, to maintain data integrity numeric columns/cells should not accept alphabetic data.

4 0
4 years ago
Other questions:
  • Which is a real-world example of a procedure?
    11·1 answer
  • How did the invention of the printing press lead eventually to an increase in the diversity of religious expression?
    7·1 answer
  • Does anybody know if that apple watch is actually worth what it costs?
    9·2 answers
  • Why does my inbox keep getting notifications and then disappearing?
    15·2 answers
  • Im getting hit offline can someone help or give me some advice
    6·1 answer
  • SNMP is a protocol used to query hosts, servers, and devices about performance or health status data. This protocol has long bee
    7·1 answer
  • How did the ENIAC change computing?<br> how did the eniac change computing
    14·1 answer
  • Fill in the blank: _____ data are statistical and numerical facts about a project.
    15·2 answers
  • Aii so is anyone pushing P?<br> if u are u a g
    8·2 answers
  • What is system software?
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!