I would appreciate some help on this. The point of the program is to take a lower bound, an upper bound, and the number of steps, and then input them into the respective chosen equation to create a matrix that is the length of the steps, that contains the values for for the equation that was chosen. I'm getting an unclassifiable statement at:
array(i)=function1(x)
array(i)=function2(x)
array(i)=function3(x)
I feel like it has something to do with how I declared my function, but I cannot figure out a fix to it. Any help would be appreciated.
PROGRAM stuff1 IMPLICIT NONE !variables INTEGER::i,step REAL::lower,upper,function1,function2,function3,x,q,w,e CHARACTER(20)::option REAL,ALLOCATABLE::array(:) !formats 101 FORMAT(A) !single text element only 102 FORMAT() ! <description> !-------Variable Definitions-------! ! ! ! !----------------------------------! !x= .1(upper-lower) !<Begin Coding Here> WRITE(*,101)"Hello User, please select a function to evaluate:" WRITE(*,101) WRITE(*,101)"A) f(x)=x^2+2x+4" WRITE(*,101)"B) f(x)=|x+4|" WRITE(*,101)"C) f(x)=sin(x)+42" WRITE(*,101)"Enter A,B,or C" DO READ(*,101)option IF ((option.EQ."A") .OR. (option.EQ."a")) THEN ELSE IF((option.EQ.'B') .OR. (option.EQ.'b'))THEN ELSE IF((option.EQ.'c') .OR. (option.EQ.'c'))THEN ELSE WRITE(*,*)"Please enter A,B,or C" CYCLE END IF EXIT END DO WRITE(*,101)"please enter an lower bound:" READ(*,*)lower WRITE(*,101) WRITE(*,101)"please enter an upper bound:" READ(*,*)upper WRITE(*,101) WRITE(*,101)"please enter a step size" READ(*,*)step function1=((x**2)+(2*x)+4) function2=(abs(x+4)) function3=(sin(x)+42) ALLOCATE(array(step)) x=lower DO i=1,step IF ((option.EQ."A") .OR. (option.EQ."a")) THEN array(i)=function1(x) ELSE IF((option.EQ.'B') .OR. (option.EQ.'b'))THEN array(i)=function2(x) ELSE IF((option.EQ.'c') .OR. (option.EQ.'c'))THEN array(i)=function3(x) END IF x=x+(upper-lower)/step END DO DO i=1,step WRITE(*,'(4F6.2)')array(i) END DO END PROGRAM