Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Numeric Base Conversion and Calculator In C, implement a program calc to add and subtract numbers specified in different bases. Hints: 9 functions. 4 functions

Numeric Base Conversion and Calculator

In C, implement a program calc to add and subtract numbers specified in different bases.

image text in transcribed

image text in transcribed

Hints: 9 functions. 4 functions to convert from ASCII to two's complement (Hex, decimal, octan and binary ascii to two's complement). 4 functions to convert two's complement to ascii (backwards). 9th function give float function 8 bit value, passes to string returns 32 bit.

Implement a program called calc with the following usage interface calc The first argument, , is either the string "+", for addition, or "", for subtraction. If you want to implement multiplication, then can also be the string "". (If you do implement multiplication, make sure to say so in your readme.pdf file so that the TAs know to check your program for this functionality.) The next two arguments, and are 64-bit, two's-complement integers. Each of these numbers will be given in the form of: which can be interpreted as: a base indicator where b means that the number is a binary number o means octal, means hexadecimal and d means decimal dndn-1..dido are the digits of the number. A decimal number may be preceded by a minus sign. Note that a minus sign is neither meaningful nor necessary for binary, octal or hexadecimal numbers as the bit pattern for these representations already covers positve and negative quantities The final argument, gives the base for the resulting output number. Like the base indicator for the input numbers, this argument can be one of four strings: "b" for binary, "o" for octal "d for decimal, and " for hexadecimal. Your program should output the answer in the same form as the input numbers (that is, the output number should follow the regular expressiorn given above)

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

Students also viewed these Databases questions

Question

4. What actions should Bouleau & Huntley take now?

Answered: 1 week ago