Question 2: (back)
Write a program that reads a line of characters from the user and displays that entire line after swapping upper case characters with lower case; that is, convert the incoming lower case characters to upper case and convert the incoming upper case characters to lower case. All non-alphabetic characters should pass through unchanged.
program Question2;
#include( "stdlib.hhf" );
begin Question2;
stdout.put( "Enter a short line of text: " );
stdin.flushInput();
repeat
stdin.getc();
if( al >= 'a' ) then
if( al <= 'z') then
and( $5f, al );
endif;
elseif( al >= 'A' ) then
if( al <= 'Z' ) then
xor( $20, al );
endif;
endif;
stdout.putc( al );
until( stdin.eoln() );
end Question2;