Octal Fractions
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 6959
Accepted: 3825
DescriptionFractions in octal (base 8) notation can is expressed exactly in decimal notation. For example, 0.75 in octal are 0.953125 (7/8 + 5/64) in decimal. All octal

Octal conversion and octal Conversion
First, we need to know what the octal is and what its numbers are.
Octal consists of 0 1 2 3 4 5 6 7;
If the number is greater than 7, we will go into the next eight places and take an eight place, that is, when the number is 10 and then 11, we will change to 10 when the number

the fractional part is multiplied by 8, until the fractional part is zero. If it can never be zero, just as the decimal number of rounding, the provisional name is called 3 4 in. Example: Converting a decimal number of 796.703125 to an octal number Solution: First divide this number into integral parts 796 and decimal parts 0.703125 The whole number of parts Number of decimal parts Therefore, the resulting

: Multiply 8 by the method, the fractional part is multiplied by 8, then take the integer part, the remainder of the fractional part continues to multiply by 8, then take the integer part, the remaining fractional part is multiplied by 8, until the fractional part is zero. If you can never be zero, the same as the rounding of decimal numbers, a temporary name called 3 Homes 4.
Example: Converts a decimal number of 796.703125 to an octal number

quotient is divided by 8, the remainder is the number on the previous right. this step continues until the quotient is 0 and starts from the last remainder at the last reading until the first remainder.
② Fractional part
Method: multiply the decimal part by 8, then take the integer part, multiply the remaining decimal part by 8, then take the integer part, and multiply the remaining decimal part by 8, until the fractional part is zero. If it cannot be zero, it is rounded to the nearest decimal

implement in electronic way. binary Data Representation binary data is also using the position counting method, and its bit right is the power of the base of 2. For example, binary data 110.11, every 2 in 1, the size of the order of 2², 2¹, 2º 、、。 For n-bit integers, the binary data of M-decimal places is represented by a weighted-coefficient expansion, which can be written as: binary data is generally written as: "Example 1102" writes binary data 111.01 as a weighting factor.

for reference by People's
how to express 8 and 16 in C language
The three types of input supported by the C language itself are:1. Decimal. Like 20,457;2.16 binary, beginning with 0x. such as 0x7a;3. Eight binary, beginning with 0. Like 05,0237.
So C language does not have binary input, the most available function to achieve.
the expression method of octal number
C + + regulations, a number if you want to indicate that it uses

How to express 8 and 16 in C language
The three types of input supported by the C language itself are:1. Decimal. Like 20,457;2.16 binary, beginning with 0x. such as 0x7a;3. Eight binary, beginning with 0. Like 05,0237.
So C language does not have binary input, the most available function to achieve.
the expression method of octal number
C + + regulations, a number if you want to indicate that it uses octal

Chapter 6 binary, octal, and hexadecimal
6.1 why do we need octal and hexadecimal?
6.2 decimal number conversion to decimal number
6.2.1 convert binary to decimal
6.2.2 convert octal to decimal
6.2.3 expression of the octal number
6.2.4 use of Octal numbers in escape charact

6.1
Why do we need octal and hexadecimal?
In programming, we usually use 10 hexadecimal notation ...... C/C ++ is a high-level language.
For example:
Int A = 100, B = 99;
However, because the representation of data in a computer exists in binary format, sometimes binary can be used to solve the problem more intuitively.
However, the binary number is too long. For example, intType occupies 4 bytes, 32 bits. For example, if the value is 100, the value

octal and hex are used in thisDerived from the relationship, that is, a three-bit binary representation of an octal, with a four-bit binary representation of a hexadecimal number.Next, remember 4 numbers 8, 4, 2, 1 (23=8, 22=4, 21=2, 20=1). Now let's practice the conversion between binary and octal.(1) binary into octalMethods: Take the Triad method, that is, fr

Binary, octal, decimal, hexadecimal conversion, binary hexadecimal1. Preface
The most boring thing during each holiday is that you don't want to get up or eat. Founder just doesn't want to move, lie in bed, watch the mobile phone, and brush QQ space bored. Although few people are playing QQ space now, however, this kind of habit has never changed until now, and the QQ on the computer is suddenly flashing. I know it's the QQ message sent by Uncle Ding,

In programming, we usually use 10 hexadecimal notation ...... C/C ++ is a high-level language.
For example:
Int A = 100, B = 99;
However, because the representation of data in a computer exists in binary format, sometimes binary can be used to solve the problem more intuitively.
However, the binary number is too long. For example, the int type occupies 4 bytes and 32 bits. For example, if the value is 100, the value expressed in the binary number of the int type is:
0000 0000 0000 0000 0110 0100

binary, need to be divided into integers and two parts of the fractional conversion2) When converting integers, the use of the addition of 2 to the remainder method, and the conversion of decimals, with the use of 2 rounding method3) Note the direction of their readingsso we can derive from the above method that the decimal number 168.125 is converted to binary 10101000.001, or the decimal number is converted to a binary number of approximately equal to 10101000.0111. (3) binary conversion to d

C/C ++
Expression of the octal number in 1Expression of the. octal number C/C ++How does one express an octal number in a language? If the number is876,We can conclude that it is not an octal number, because it is impossible to generate7The Arabic numerals above. But if the number is123Yes567, Or12345670Is it

the island, after all, someone else's Japanese level, if not to the heart also can't get through.Or as usual, eating a copy of the hand, discussing what we have been doing in the company recently, an unintentional conversation, he asked me to know what is binary, I said know, he went on to ask, do you know how to use it, I said don't know, don't use binary, still can't write code? Said so much after all, Uncle Ding, still so cool, only blame oneself learn and not fine, so have this article.Bina

OverviewIn fact, the X-decimal algorithm is similar, but if it is in the form of characters, they are a little different. The use of pointers and arrays is different. Here is a demonstration of the octal format of an array of character types into decimal:1#include 2#include 3#include 4 5#define MAX 106 7Initializes the array to octal.8 void9Init (char *octal) {Te

Original article: Is0 a decimal literal or an octal literal?
Translation: C ++Is 0 decimal or octal?
Translator: justjavac
In C ++, is 0 decimal or octal?
Even in any number of input systems, 0 has only one value, that is, "zero". The reason for asking this question is purely idle.
He recently discussed the topic about data with his friends. He said that eight-d

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.