
ADTs, Data Structures, and Problem Solving with C++ 2nd Edition by Larry Nyhoff
النسخة 2الرقم المعياري الدولي: 978-0131409095
ADTs, Data Structures, and Problem Solving with C++ 2nd Edition by Larry Nyhoff
النسخة 2الرقم المعياري الدولي: 978-0131409095 تمرين 3
Write a program that reads lines of input consisting of a bitwise operator (see Problem 1)- , |, ~, ^, , or -followed by integer operand(s) and then outputs the integer operands, the bitwise operator, and the result obtained by applying the operator to the operands. Display all numbers both in decimal form and in their 32-bit binary representation, using the printBinary() function from Problem 1. For example, the input
13 27 might produce the output
Applying the bitwise AND operator to the following 13 = 00000000000000000000000000001101 27 = 00000000000000000000000000011011produces 9 = 00000000000000000000000000001001 and the input
~ 1
produce the output
Applying the bitwise NOT operator ~ to the following 1 = 00000000000000000000000000000001produces -2 = 11111111111111111111111111111110
13 27 might produce the output
Applying the bitwise AND operator to the following 13 = 00000000000000000000000000001101 27 = 00000000000000000000000000011011produces 9 = 00000000000000000000000000001001 and the input
~ 1
produce the output
Applying the bitwise NOT operator ~ to the following 1 = 00000000000000000000000000000001produces -2 = 11111111111111111111111111111110
التوضيح
Program Plan:
Main method:
• Declare t...
ADTs, Data Structures, and Problem Solving with C++ 2nd Edition by Larry Nyhoff
لماذا لم يعجبك هذا التمرين؟
أخرى 8 أحرف كحد أدنى و 255 حرفاً كحد أقصى
حرف 255