|
-
Mar 7th, 2002, 05:29 PM
#1
Thread Starter
Frenzied Member
number bases/input
I have to convert an entered number to decimal...how can I do this? won't the computer think the number is decimal when inputted?
-
Mar 8th, 2002, 03:55 AM
#2
Fanatic Member
Where do you get the numbers from? Is it read from a file or does the user have to enter them manually?
If the user enters numbers manually, any conversion to the binary format, in which all values are stored in memory, is performed automatically.
In C++ you can enter (integral) numbers in three formats.
* decimal (base = 10)
* octal (base = 8, the first digit must be a zero)
* hexadecimal (base = 16, the first two digits must be 0x)
This is the same way if you enter a number in your code.
Floating point values can only be entered decimally, but I'm not sure about that.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|