作者dy93 (梁嫩)
看板ck60th307
標題[徵人] 我程式作業要趕不出來了= ="
時間Sat Jan 3 14:11:43 2009
如題...
所以徵翻譯...
不是code的喔...
希望有人看得懂這篇莫名奇妙的題目= =
話說版規沒有一條說這裡不能當問版XD
因為我沒有免費空間= =" 所以用複製的...
Introduction to Computers and Programming Homework 6
Problem 1
Write a program that right shifts an integer variable 4 bits. The program
should print the integer in bits before and after the shift operation. Does
your system place 0s or 1s in the vacated bits?
Problem 2
Left shifting an unsigned integer by 1 bit is equivalent to multiplying the
value by 2. Write function
power2 that takes two integer
arguments number and pow and
calculates number * 2^pow
Use the shift operator to calculate the result. Print the values as integers
and as bits.
Problem 3
Write a program that reverses the order of the bits in an unsigned integer
value. The program should input the value from the user and call function
reverseBits to print the bits in reverse order. Print the value in bits both
before and after the bits are reversed to confirm that the bits are reversed
properly.
感謝〒△〒
※ 編輯: dy93 來自: 118.169.211.208 (01/03 14:13)
→ alan790712:載點 我丟到清大的空間了 01/03 15:12
→ dy93:樓上揪甘心!! 01/03 16:13