Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN C++ PLEASE: Hexadecimal addition(Make sure to use files. Show the output in the end and a screenshot of the file) Write a program that

IN C++ PLEASE: Hexadecimal addition(Make sure to use files. Show the output in the end and a screenshot of the file)

Write a program that reads in two hexadecimal numbers from a file, hex.txt, and prints out the sum of the two numbers in hexadecimal.

From Wikipedia: In mathematics and computer science, hexadecimal (also base 16, or hex) is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 09 to represent values zero to nine, and A, B, C, D, E, F (or alternatively af) to represent values ten to fifteen. For example, the hexadecimal number 2AF3 is equal, in decimal, to:

(2 163) + (10 162) + (15 161) + (3 160), or 10,995.

For example, if the file contains:

45AF

12B3

...your program will the result in decimal:

The decimal sum of 45AF and 12B3 is 22626.

(To check your results, you can go to a hexadecimal calculator on the web. For example, http://www.csgnetwork.com/hexaddsubcalc.html )

To solve this problem:

a) Read the hexadecimal numbers as character arrays

b) Convert the character arrays to numbers (by calling a function that takes the character array as a parameter, and returns an integer)

c) Add the numbers to get a decimal sum

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Current Trends In Database Technology Edbt 2006 Edbt 2006 Workshops Phd Datax Iidb Iiha Icsnw Qlqp Pim Parma And Reactivity On The Web Munich Germany March 2006 Revised Selected Papers Lncs 4254

Authors: Torsten Grust ,Hagen Hopfner ,Arantza Illarramendi ,Stefan Jablonski ,Marco Mesiti ,Sascha Muller ,Paula-Lavinia Patranjan ,Kai-Uwe Sattler ,Myra Spiliopoulou ,Jef Wijsen

2006th Edition

3540467882, 978-3540467885

More Books

Students also viewed these Databases questions

Question

Describe the role of the IFRS Interpretations Committee.

Answered: 1 week ago

Question

1. What are the peculiarities of viruses ?

Answered: 1 week ago

Question

Describe the menstrual cycle in a woman.

Answered: 1 week ago