Binary to some other way to convert, let me know thanks

Updated on amusement 2024-05-19
8 answers
  1. Anonymous users2024-02-11

    1.Call n=getvalue("111010101",9,2);Get the decimal system of binary characters.

    2.call outstrint(n,s); Output this value in base S (s is in binary to hexadecimal).

    For example, put binary"11111111", which is called in octal output like this:

    outstring(getvalue("11111111",8,2),8);

    You can of course modify the program to store the output where you want.

    s is the string to be converted, l is the string length, and n is the base of the number represented by the string.

    2 to 16 with return values as integers, decimal values.

    int getvalue(char* s,int l,int n)if (s==0 ||n<=1 ||n>16)return 0;

    int i;

    char c;

    int value = 0;

    int q = 1;

    for (i=0;i='0' &&c<='0'+n-1)value+=q*(c-48);

    q*=n;else

    if (n<11)

    return 0;Wrong data.

    else if (c>='a' &&c<='a'+n-11)value+=q*(c-'a'+10);

    q*=n;else if (c>='a' &&c<='z'+n-11)value+=q*(c-'a'+10);

    q*=n;else return 0;Illegal character return value;

    Input decimal numbers as any base (2 to 16) void outstring(int n, int j)static char s[256];

    char t;

    if (j<=1 ||j>16)

    return;

    int i = 0;

    int k;

    while (n)

    k = n%j;

    if (k<10)

    s[i++]= '0'+k;

    else s[i++]= 'a'+k-10;

    n/=j;s[i--]= 0;

    for (k=0;kprintf("%s",s);

  2. Anonymous users2024-02-10

    It is recommended not to change it, because if it is changed, it may affect the work of some systems.

  3. Anonymous users2024-02-09

    Binary shouts early ashwagandha conversion.

    for octal method:

    1. Take the three-in-one method, that is, take the decimal point from the binary as the demarcation point, take every three digits to the left (to the right) into one, and then add the three binaries according to the weight, and the number obtained is an eight-digit binary number.

    Then, in order, the decimal point remains the same, and the resulting number is the octal number we are looking for.

    If you take three digits to the left (right) and get the highest (lowest) digit, if you can't make up three digits, you can add 0 to the leftmost (rightmost) digit of the decimal point, that is, the highest digit (lowest digit) of the integer, to make up three digits. Example:

    Convert binary numbers to octals.

    Get the result: will convert to octal as.

    Convert binary numbers to octals.

    Get the result: will convert to octal as.

    2. Take a three-point method, that is, decompose a one-digit octal number into a three-digit binary number, and use the three-digit binary to add the weight to make up the octal number, and the decimal place remains the same. Example:

    Convert octal numbers to binary.

    Therefore, converting an octal number to a binary number is, ie.

  4. Anonymous users2024-02-08

    Introduction to the conversion methods between various base systems:

    1. Binary to decimal.

    Example: binary "1101100".

    1101100 binary number.

    6543210 Ranking method.

    For example, the algorithm for converting binary to decimal is as follows:

    Note: 2 represents the base system, and the following number is the power (count from right to left, starting with 0).

    2. Binary conversion to octal.

    Example: Binary "10110111011".

    When changing the octal system, from right to left, a group of three, not enough to make up 0, that is:

    Then the 3 numbers in each group correspond to the state of , and then the state of 1 will be added, such as:

    The result is: 2673

    3. Binary to hexadecimal.

    The method of hexadecimal to binary is similar, as long as each group of 4 digits corresponds to each other, such as decomposing as:

    The operation is: 1011 = 8+2+1 = 11 (since 10 is a, 11 is b).

    1011 = 8 + 2 + 1 = 11 (since 10 is a, 11 is b).

    The result is: 5bb

    4. Binary numbers are converted to decimal numbers.

    The weight of the 0th digit of a binary number is 2 to the power of 0, and the weight of the 1st digit is to the power of 2......

    So, there is a binary number: 0110 0100, which is converted to decimal as :

    Calculation: 0 * 20 + 0 * 21 + 1 * 22 + 1 * 23 + 0 * 24 + 1 * 25 + 1 * 26 + 0 * 27 = 100

    5. Octal numbers are converted to decimal numbers.

    Octadecimal is every 8 into 1

    Octal numbers use the eight numbers 0 7 to express a number.

    The 0th digit of an octal number has a weight of 8 to the power of 0, the 1st digit has a weight of 8 to the 1st power, and the 2nd digit has a weight of 8 to the 2nd power......

    So, there is an octal number: 1507, which is converted to decimal as:

    Calculation: 7 * 80 + 0 * 81 + 5 * 82 + 1 * 83 = 839

    As a result, the octal number 1507 is converted to a decimal number of 839

    6. Hexadecimal to decimal.

    Example: 2af5 to decimal system.

    The direct calculation is: 5 * 160 + f * 161 + a * 162 + 2 * 163 = 10997

    Don't forget, in the above calculation, a is 10, and f is 15).

    It can now be seen that the key to converting all decimal systems to decimal system is that their respective weights are different.

    Suppose someone asks you, why is decimal 1234 one thousand two hundred and thirty-four? You can give him this equation: 1234 = 1 * 103 + 2 * 102 + 3 * 101 + 4 * 100

  5. Anonymous users2024-02-07

    Conversion between decimal and binary numbers.

    1) Convert decimal integers to binary integers.

    Here's how to convert a decimal integer to a binary integer:

    Divide the converted decimal integer by 2 repeatedly until the quotient is 0, and the resulting remainder (read from the last place) is this number.

    Binary representation. To put it simply, yes"Divide by 2 remainder method".

    For example, place a decimal integer (2, 1, 5).

    Here's how to convert 1 0 to a binary integer:

    So, ( 2 1 5 ).

    2 The way to convert to a hexadecimal integer is:"Divide by 1 6 remainder".

  6. Anonymous users2024-02-06

    In this way, let's assume that a number 10111b, to convert to occimal, we can first convert the binary number to decimal, that is: 1*2 4+0*2 3+1*2 2+1*2 1+1*2 0=23, and then divide 23 by 8 to get 2, and the remaining 7 is (10111)2=(27)8

  7. Anonymous users2024-02-05

    In general, any binary n can be expressed as n=2j s; where j is a binary number, called a step code; If there are positive and negative signs, the positive and negative signs are called order symbols; s is a pure decimal, which is called a mantissa number; A number symbol, which refers to the symbol of the entire number of n.

    Binary "00101000" can be converted directly to "28" in hexadecimal. Bytes are the basic storage units in the computer, according to the different length of the computer, the word has different digits, the word length of modern computers is generally 32 bits, that is, the number of bits of a word is 32.

    A byte is an 8-bit unit of data, and a byte can represent 0 255 decimal data. For a 32-bit word length in modern computers, a word is equal to 4 bytes, and for the early 16-bit electric eggplant Jane Brain, a word is equal to 2 bytes.

  8. Anonymous users2024-02-04

    The uppercase letter is before the lowercase letter, and the difference between the case and the case is fixed is 32, so if you know that the uppercase is Hengxingzhi 68, plus 32 is the corresponding lowercase letter.

    The ASCII code encoding rule is that the lowercase letter is 32 days larger than the ASCII code of the corresponding uppercase letter'The ASCII code is 68, then'd'The ASCII code is 68 + 32 = 100J'The ASCII code is 100 + 6 = 106

    Decimal is converted to binary.

    106 (d) = 01101010 (b), select the first one.

Related questions
9 answers2024-05-19

#include

using namespace std; >>>More

9 answers2024-05-19

Generally speaking, the bit power of the binary system is the number of bits, and the binary bit power is 2. >>>More

5 answers2024-05-19

Binary is a system of numbers that is widely used in computing technology. Binary numbers are numbers represented by two numbers, 0 and 1. Its base is 2, the carry rule is "every two into one", and the borrowing rule is "borrow one as two". >>>More

8 answers2024-05-19

Convert decimal integers to binary numbers.

The divide by 2 reverse remainder method is adopted: >>>More

8 answers2024-05-19

1.Binary 1000 is replaced by 16.

With the 8421 conversion method, that is, from left to right, 8*1+4*0+2*0+1*0=0x8, this is the universal conversion method for all hexadecimal to binary, bit-to-bit alignment conversion, multiply by 8421 respectively, and then add up. If the binary number. >>>More