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
Alborosie
3 years ago
4

Imagine that you are prototyping an electronic device based on the Arduino platform and you are using a seven-segment display to

show numeric values. To reduce the number of used digital outputs of the microcontroller, the display board is connected to the main board through the integrated circuit of the decoder, which converts binary coded decimal (BCD) values to signals for the seven-segment display. So, to show any number on the display you need to set the required BCD code on the microcontroller's outputs. Write a program to convert an integer number represented as a string to a BCD code required for the display. In the BCD code, every decimal digit is encoded with its four-bit binary value. Encoding all digits of the decimal number and concatenating the resulting codes into one string you will get a resulting BCD code. A space is used to separate digits in the BCD code and make it more readable. For example, a number 173 will be encoded to BCD as 0001 0111 0011.
Computers and Technology
1 answer:
myrzilka [38]3 years ago
6 0

We can write this program (to convert an integer number represented as string to BCD code) in C++ as;

<u>Integer number (string) to BCD code using C++</u>

#include <iostream>  

#include <string>  

using namespace std;  

int binaryToDecimal(string n)  

{  

string num = n;  

int dec_value = 0;  

int base = 1;  // Initializing base value to 1, i.e 2^0

int len = num.length();  

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

 if (num[i] == '1')  

  dec_value += base;  

base = base * 2;  

}  

return dec_value;  

}  

You might be interested in
Hey guys i need help again on coding
BartSMP [9]

Answer:

what do you need help with?

Explanation:

6 0
3 years ago
Which of the following best defines natural selection?
Vsevolod [243]
The answer is differential success in some organisms reproduction due to traits that favor survival <span />
6 0
3 years ago
What is an examlple of cyberbullying
Alex73 [517]

Answer:

sending rude text messages

Explanation:

3 0
4 years ago
When can screentips be useful? when finding a tab when looking for a command when pinning the ribbon when using a command.
Anettt [7]

Screentips be useful when looking for a command.

<h3>What are Screentips?</h3>

These are referred to small windows which displays descriptive text when the pointer is rested on a command and it is usually done using the mouse.

Screentips is therefore useful when an individual is looking for a command as a result of the information derived from the descriptive texts.

Read more about Screentips here brainly.com/question/18955460

6 0
3 years ago
The two fundamental approaches to moving data through a network of links and switches are
olga55 [171]

Answer:Packet and circuit switching

Explanation: Packet switching is the technique through which the data is sent from the source to destination in the form of data packets on dynamic path.It is the time of connectionless switching and route generates for each packet.

Circuit switching is the switching technique having connected path for the sending and receiving of the data.They have well defined and established path for the transmission of data.

Other options are incorrect because they define the terms that are associated with the data that gets transmitted like bandwidth,transmission rate ,packet etc. These options are not the way in which data transmitted or switched.Thus, the correct option is packet and circuit switching.

6 0
3 years ago
Other questions:
  • Nancy finds it difficult to locate emails in her Inbox. What action should she take to locate a particular type of email instant
    11·2 answers
  • What command would you use to make a secure shell connection to the ubuntu client machine? ()?
    9·1 answer
  • Which feature of a browser will you select to block pop-ups? view help tools file
    15·2 answers
  • What’s of the following can be used to visually represent information similar to diagrams format painter Helens smart are a clip
    8·1 answer
  • To close a tab, click the ____ button in the web page thumbnail on the tab switcher.
    9·1 answer
  • Good afternoon guys !!!
    14·2 answers
  • Delivering is not considered in supply chain analysis when outside carriers are contracted to move products to customers.
    15·1 answer
  • The dramatic increase in the number of people having access to the Internet has been made possible, in part, because of the rela
    8·1 answer
  • Match each code snippet to its appropriate markup language name. XML CSS HTML XHTML<br><br><br>​
    10·1 answer
  • 1
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!