Submit the .cpp source code file on Ecampus under the "Submit Homework" menu option.

Write a console C++ program (compilable with GCC) that converts an integer to 32-bit signed magnitude, and two's complement.  Add a space between every 8 bits.  The only library you can include is <iostream>.   You must follow the algorithm shown in my tutorial video.

Example output
This program converts an integer to 32-bit signed magnitude and two's complement.

Enter an integer: -255

Signed magnitude: 10000000 00000000 00000000 11111111
Two's complement: 11111111 11111111 11111111 00000001

Enter an integer: 15

Signed magnitude: 00000000 00000000 00000000 00001111
Two's complement: 00000000 00000000 00000000 00001111