// Isalpha and iSUPper function are standard library functions, which are as follows: int islower (int C) {return 'a' <= C && c <= 'z';} int isupper (int C) {Return 'a '<= C && c <=' z ';} int isalpha (int C) {return islower (c) || isupper (c);}
// TestXxxx function is a test case. # include
CHAR Postpone (CHAR ORIG, INT DISTANCE) {// Does not handle non-alphabetics == 0) {Return Orig;
INT D = Distance% 26; char TOP = (iSUPPER? 'Z': 'Z') - D;
/ / Include Orig
#ifndef ndebug printf ("IF '% C' [% 3D]> '% C' [% 3D] THEN PUT OFF% 3D get% C [% 3D] N", Orig, ORIG, TOP, TOP, D, ORIG D, Orig D); # Endif Return Orig D;} void testpostponenonealpha () {assert (postpone ('', 4) == '); assert (POSTPONE (' _ ', 4) ==' '); Assert (' ~ ', 4) ==' ~ ');
Void TestPostPone4Letter () {assert (postpone ('a', 4) == 'e'); Assert ('A', 4) == 'E');
Assert ('V', 4) == 'Z'); Assert ('V', 4) == 'Z');
Assert ('W', 4) == 'a'); Assert ('W', 4) == 'A');
Assert (Postpone ('Z', 4) == 'D'); Assert (Postpone ('Z', 4) == 'd');}
Void TestPostPone0letter () {assert (postpone ('V', 0) == 'V'); Assert (Postpone ('V', 0) == 'V');
Assert ('w', 0) == 'W'); Assert ('w', 0) == 'W'); Assert (POSTPONE ('Z', 0) == 'Z') Assert ('z', 0) == 'Z');}
Int main () {TestPostPonennealpha () TestPostPone4Letter (); TestPostPone0letter (); Return 0;}