decimal1, binary1, octal1, hexa1 – варианты представления первого числа;
decimal2, binary2, octal3, hexa4 – варианты представления второго числа;
decimal_res, binary_res, octal_res, hexa_res – варианты представления результата;
var notation: byte; decimal1: integer; binary1, octal1, hexa1: string; decimal2: integer; binary2, octal2, hexa2: string; decimal_res: longint; binary_res, octal_res, hexa_res: string; operation: char; function decimal_binary(decimal:integer): string; begin см. предыдущий этап end; function decimal_octal(decimal:integer): string; begin см. предыдущий этап end; function decimal_hexa(decimal:integer):string; var digit:byte; ch:char; begin см. предыдущий этап end; function binary_decimal(binary:string):integer; var n,m,i,j,digit:byte; pow:integer; begin см. предыдущий этап end; function octal_decimal(octal:string):integer; var n,m,i,j,digit:byte; pow:integer; begin см. предыдущий этап end; function hexa_decimal(hexa:string):integer; var n,m,i,j,digit:byte; pow:integer; ch: char; begin см. предыдущий этап end; procedure manager(var decimal:integer; var binary,octal,hexa:string; notation:byte); begin if notation = 2 then begin readln(binary); decimal := binary_decimal(binary); octal := decimal_octal(decimal); hexa := decimal_hexa(decimal) end else if notation = 8 then begin readln(octal); decimal := octal_decimal(octal); binary := decimal_binary(decimal); hexa := decimal_hexa(decimal) end else if notation = 10 then begin readln(decimal); binary := decimal_binary(decimal); octal := decimal_octal(decimal); hexa := decimal_hexa(decimal) end else if notation = 16 then begin readln(hexa); decimal := hexa_decimal(hexa); binary := decimal_binary(decimal); octal := decimal_octal(decimal) end else writeln('Must be goto end.'); end; begin write('Notation: '); readln(notation); write('Number one: '); manager(decimal1,binary1,octal1,hexa1,notation); write('Number two: '); manager(decimal2,binary2,octal2,hexa2,notation); write('Operation (+,-,*,/): '); readln(operation); if operation = '+' then decimal_res := decimal1 + decimal2 else if operation = '-' then decimal_res := decimal1 - decimal2 else if operation = '*' then decimal_res := decimal1 * decimal2 else if operation = '/' then decimal_res := decimal1 div decimal2 else writeln('Error operation'); binary_res := decimal_binary(decimal_res); octal_res := decimal_octal(decimal_res); hexa_res := decimal_hexa(decimal_res); writeln; writeln('notation:':10,'2':10,'8':5,'10':5,'16':5); writeln; writeln('value:':10,binary1:10,octal1:5,decimal1:5,hexa1:5); writeln('value:':10,binary2:10,octal2:5,decimal2:5,hexa2:5); writeln(' ':10,'-------------------------'); writeln('result:':10,binary_res:10,octal_res:5,decimal_res:5,hexa_res:5); readln end.
Последние комментарии
1 неделя 18 часов назад
1 неделя 1 день назад
1 неделя 1 день назад
1 неделя 1 день назад
1 неделя 2 дня назад
1 неделя 2 дня назад
1 неделя 3 дня назад
1 неделя 3 дня назад
1 неделя 4 дня назад
2 недели 12 часов назад