Step 6

In this section:

factor6.for contains the finished program. In this program the factoriser function has been developed to do the calculations needed to factorise the number that is supplied by the user. The details of this simple Fortran code are not of direct interest to us in this tutorial but here is the code for those who want to read it.

INTEGER FUNCTION factoriser()
INTEGER number,n,k
CHARACTER*50 str,val
COMMON number,str
WRITE(val,'(i11)')number
CALL trim@(val)
str='The factors of '//val(1:LENG(val))//' are: 1'
n=number
1 DO k=2,n
  IF((n/k)*k.EQ.n)THEN
    WRITE(val,'(i11)')k
    CALL trim@(val)
    CALL append_string@(str,', '//val)
    n=n/k
    IF(n.GT.1)GOTO 1
  ENDIF
END DO
CALL window_update@(str)
factoriser=1
END

This is what the final program displays on the screen:

This brings us to the end of the tutorial. In this one demonstration program you have been introduced to some of the important format codes that come with winio@. More importantly you have been able to experience the ease with which it is possible to develop a GUI application with ClearWin+.

 

 

Basket
Empty
 
Copyright © 1999-2024 Silverfrost Limited