如何解决以下问题? [英] how to solve the following question?

查看:86
本文介绍了如何解决以下问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设代替

整数的二进制或十进制表示,我们有一个使用5位数的表示,即。 0,1,2,3,4,

以及5的补码,整数表示。对于

示例,整数147表示为(01042)5 =(在

十进制中)+ 1. 53 + 0. 52 + 4. 51 + 2. 30 ,前导零值

表示正号。

和5的补码中的整数(-147)表示为

13403,领先1表示负号。其他数字,

除了最右边,在( - 147)的表示中获得

,从147的相应数字中减去4

表示,然后加1(-147的表示是

获得13402 + 00001)。

编写算术程序(否定整数) ,另外,使用5的

补码表示的整数的
减法和乘法两个整数)。该程序应包括一个

程序,用于计算两个整数的整数,加法,减法和乘法的每个否定。整数将使用

8个5位数的位置,其中最左边的位置将用于

的标志。

使用你的程序找到每个

十进制数/表达式的5位数表示:345,-297,18和

((345-297)* 18)

Suppose that instead of binary or decimal representation of
integers, we have a representation using 5 digits, viz. 0,1,2,3,4,
along with 5’s complement, representation of integers. For
example, the integer 147 is represented as (01042)5 = (in
decimal) + 1. 53 + 0. 52 + 4. 51 + 2. 30, where the leading zero
indicates positive sign.
And the integer ( -147 ) in 5’s complement is represented by
13403, the leading 1 indicates negative sign. The other digits,
except the right-most, in the representation of ( – 147) are obtained
by subtracting from 4 the corresponding digit in 147’s
representation, and then adding 1 (the representation of –147 is
obtained as 13402 + 00001).
Write a program for the arithmetic (negation of an integer, addition,
subtraction and multiplication of two integers) of integers using 5’s
complement representation. The program should include a
procedure for calculating each of negation of an integer, addition,subtraction and multiplication of two integers. The integers will use
8 5-digit positions, in which the left-most position will be used for
sign.
Using your program find the 5-digit representation of each of the
decimal numbers/ expression: 345, -297, 18 and
((345-297) * 18)

推荐答案

我们不做你的作业:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



如果遇到具体问题,请询问相关问题,我们会尽力提供帮助。但我们不打算为你做这一切!
We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!


这篇关于如何解决以下问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆