Объяснение:
1. Пронумеруем разряды:
3-й разряд - 4;
2-й разряд - 1;
1-й разряд - 5;
0-й разряд - 3.
4153₈=4·8³+1·8²+5·8¹+3·8⁰
2. 4153₈=4·8³+1·8²+5·8¹+3·8⁰=2048+16+40+3=2155₁₀
3. 125/8=15 (5)
15/8=1 (7)
(1)
125₁₀=175₈
4. Пронумеруем разряды:
2-й разряд - A;
1-й разряд - 6;
0-й разряд - E;
A6E₁₆=(10)(6)(14)=10·16²+6·16¹+14·16⁰
5. A6E₁₆=10·16²+6·16¹+14·16⁰=2560+96+14=2670₁₀
6. 350/16=21 (14=E)
21/16=1 (5)
(1)
350₁₀=15E₁₆
7. 247/2=123 (1)
123/2=61 (1)
61/2=30 (1)
30/2=15 (0)
15/2=7 (1)
7/2=3 (1)
3/2=1 (1)
(1)
247₁₀=11110111₂
247/8=30 (7)
30/8=3 (6)
(3)
247₁₀=367₈
247/16=7 (15=F)
(7)
247₁₀=7F₁₆
Получившиеся числа между собой равны, так как имеют одинаковое число в десятичной системе счисления.
#include <iostream>
#include <stdio.h>
using std::cout;
using std::endl;
typedef enum { enSuccess, enWrongCmdLine, enFileOpenError } __ExitCodes;
int main(int argc, char **argv)
{
if(argc != 3) { cout<<"Usage: "<<argv[0]<<" <in_file> <out_file>"<<endl; return enWrongCmdLine; }
FILE *_inFile = fopen(argv[1], "r+b"); if(_inFile == 0) { cout<<"Cannot open input file "<<argv[1]<<endl; return enFileOpenError; }
FILE *_outFile = fopen(argv[2], "w+b");
if(_outFile == 0)
{
cout<<"Cannot open output file "<<argv[2]<<endl;
fclose(_inFile);
return enFileOpenError;
}
char *_buffer[1024];
while(!feof(_inFile) fwrite(_buffer, fread(_buffer, sizeof(_buffer), 1, _inFile), 1, _outFile);
fclose(_inFile); fclose(_outFile);
return enSuccess;
}