A possible solution of the problem:

 

! Write a subroutine to swap two strings that are passed as parameters.

! Test your subroutine using the strings "TRUE" and "FALSE".

 

!Test Practice Program 2

LET A$ = "TRUE"

LET B$ = "FALSE"

SOUND 1000,.1

SET COLOR "blue"

PRINT "Before swap, A$ = "; A$;" "; "and B$ = ";B$

CALL Swap (A$,B$)

SET COLOR "green"

PRINT "After swap, A$ = "; A$;" "; "and B$ = ";B$

END

 

SUB Swap (C$,D$)

SOUND 2000,0.2

LET temp$ = C$

LET C$ = D$

LET D$ = temp$

END SUB

 


Before swap, A$ = TRUE and B$ = FALSE

After swap, A$ = FALSE and B$ = TRUE