I need to print on screen a variable value that is encoded in BCD.
Do you know whether is possible to print it on screen by using itoa?
If that is possible, how to do that?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No,
itoawill not help. You want to look at the hexadecimal representation, so usehexlike incout << hex << n << endl;Note: BCD codes the digits as 4-bit-sequences 0000 to 1001, which in hexadecimal are 0 to 9.
So 23 as BCD would be
0010 0011bitwise, or in fact as 8bit integer it would be 35, so converting this to a string will not be of much use.