Okay I'm clearly not making sense so I'm going to copy/paste the problem.
Ask the user to enter a line of text and then read it in a character at a time. For each character, print the character as a character, its hex value, its decimal value, and its binary value. (One of the philosophic points of this assignment is remind you that there are no numbers or characters inside the computer; there are just binary bit patterns that have no intrinsic meaning until your program tells the computer how to interpret/manipulate them.) Just to give you a little more work (it's unnecessary to thank me ;-) also count and print the number of bits that are set to 1 in the binary. Here's a sample output:
Enter a line of text: Hello there! The ASCII code for 'H' is 0x48 in hex, 72 in decimal, or 01001000 in binary, 2 bits were set.
The ASCII code for 'e' is 0x65 in hex, 101 in decimal, or 01100101 in binary, 4 bits were set.
The ASCII code for 'l' is 0x6c in hex, 108 in decimal, or 01101100 in binary, 4 bits were set.
The ASCII code for 'l' is 0x6c in hex, 108 in decimal, or 01101100 in binary, 4 bits were set.
The ASCII code for 'o' is 0x6f in hex, 111 in decimal, or 01101111 in binary, 6 bits were set.
The ASCII code for ' ' is 0x20 in hex, 32 in decimal, or 00100000 in binary, 1 bits were set.
The ASCII code for 't' is 0x74 in hex, 116 in decimal, or 01110100 in binary, 4 bits were set.
The ASCII code for 'h' is 0x68 in hex, 104 in decimal, or 01101000 in binary, 3 bits were set.
The ASCII code for 'e' is 0x65 in hex, 101 in decimal, or 01100101 in binary, 4 bits were set.
The ASCII code for 'r' is 0x72 in hex, 114 in decimal, or 01110010 in binary, 4 bits were set.
The ASCII code for 'e' is 0x65 in hex, 101 in decimal, or 01100101 in binary, 4 bits were set.
The ASCII code for '!' is 0x21 in hex, 33 in decimal, or 00100001 in binary, 2 bits were set.
I've already got the way to get the binary representation printed out, I just need it to be stored in one place. See the code in the first post.