C and C++

Moderators: None (Apply to moderate this forum)
Number of threads: 28691
Number of posts: 94711

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
need ur help. Posted by Waheed Akbar on 6 Apr 2006 at 11:38 AM
Dear Members I want to make such a digital calculator which has the description:


On the basis of users choice, calculate the arithmetic (Addition & Subtraction) expression given by user.

1.Decimal Mode
2.Binary Mode
3.Octal Mode
4.Hexadecimal Mode

Its mean that in every mode we are capable to make addition and subtraction but just for that specific mode which has to be called.

Report
Re: need ur help. Posted by tom_sw on 6 Apr 2006 at 11:44 AM
: Dear Members I want to make such a digital calculator which has the description:
:
:
: On the basis of users choice, calculate the arithmetic (Addition & Subtraction) expression given by user.
:
: 1.Decimal Mode
: 2.Binary Mode
: 3.Octal Mode
: 4.Hexadecimal Mode
:
: Its mean that in every mode we are capable to make addition and subtraction but just for that specific mode which has to be called.
:
:
I would suggest that you just use the common math functions (decimal) for that actual operations. The mode will simply translate the current values from the indicated mode to decimal.

For example, if the mode is Binary, you input a string, then feed that to a function that returns the decimal value of that binary string. Perform the indicated math function on that value. Then feed the resultant decimal value to another function that will transform the value to a binary string adn write that string to the result line or window.

Have other functions to do the transformations from/to hex and octal as well - or make your functions generic with a flag for the type of transform to perform.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.