Purpose To let you demonstrate your ability to manipulate C

Purpose:

To let you demonstrate your ability to manipulate C integers.

Assignment: Bit pattern manipulation

Finish the program below that does several bit-wise manipulations of C integers.

Cut and paste the following:

Finish the Program!

You may only use the integer constants given at the beginning. (You may use whatever integers you wish in string constants as long as they are for printf()\'s. For example the format string \"0x%08X\" is useful for printing hexadecimal integers.)

You may only use the following integer operators:

+

-

++

--

<<

>>

~

|

&

<

>

=

!=

==

Sample output (32 bit):

Sample output (64 bit):

Solution

include <iostream>
#include <cstdlib>
#include <string>
#include \"String.h\"
using namespace std;
int main (int argc, char **argv)
{
//Testing Default constructor, length, and print
String one;
cout << \"The length of String one is: \" << one.length() << endl;
cout << \"The value of String one is: \";
one.print();
  
//Testing Alternate constructor, length, and print
char test[256] = \"Hello world\";
String two(test);
cout << \"The length of String two is: \" << two.length() << endl;
cout << \"The value of String two is: \";
two.print();
  
//Testing the overloaded [] operator. This replaces your at() function.
cout << \"The first letter is: \" << two[0] << endl;
  
return 0;
}

Purpose: To let you demonstrate your ability to manipulate C integers. Assignment: Bit pattern manipulation Finish the program below that does several bit-wise
Purpose: To let you demonstrate your ability to manipulate C integers. Assignment: Bit pattern manipulation Finish the program below that does several bit-wise

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site