In an alphabetic ASCII character, the third bit from the left is the case-shift bit. This bit is 0 for uppercase letters
Posted: Sun May 15, 2022 8:06 am
In an alphabetic ASCII character, the third bit from the left is
the case-shift bit. This bit is 0 for
uppercase letters and 1 for lower-case letters. Except for this
bit, the code of an upper-case letter is
the same as its lower-case counterpart. Write a program that
contains a bitmask for the case-shift
bit. Read three lines of characters using scanf( " %c", ... ). Do
the operations described here and
print the results. Assume that each line, including the last, will
end with a newline character.
a. On the first line of input, use a mask and one bitwise operator
to toggle the case of the input; that is,
change B to b or b to B.
b. On the second line of input, use your mask and one bitwise
operator to change the input to all
uppercase.
c. On the third line of input, use your mask and one bitwise
operator to change the input to all
lowercase.
In these, make sure to change only alphabetic letters; do not alter
the values of numerals, special
symbols, and the like. Use the library function isalpha() for
this.
the case-shift bit. This bit is 0 for
uppercase letters and 1 for lower-case letters. Except for this
bit, the code of an upper-case letter is
the same as its lower-case counterpart. Write a program that
contains a bitmask for the case-shift
bit. Read three lines of characters using scanf( " %c", ... ). Do
the operations described here and
print the results. Assume that each line, including the last, will
end with a newline character.
a. On the first line of input, use a mask and one bitwise operator
to toggle the case of the input; that is,
change B to b or b to B.
b. On the second line of input, use your mask and one bitwise
operator to change the input to all
uppercase.
c. On the third line of input, use your mask and one bitwise
operator to change the input to all
lowercase.
In these, make sure to change only alphabetic letters; do not alter
the values of numerals, special
symbols, and the like. Use the library function isalpha() for
this.