program cooling implicit none c Note that t and T are the same for Fortran real r,time,t_max,T,Ts,T_ini,delta_t integer pgopen,i,n_steps,i_again write (*,*) 'Please type in the cooling rate r and the surrounding & temperature Ts :' read (*,*) r, Ts write (*,*) 'Please type in the time duration and the initial & temperature T_0 :' read (*,*) t_max, T_ini if(pgopen('/xwin').le.0) stop call pgpap (5.0,0.75) 100 write (*,*) 'Please type in the small time interval delta_t :' read (*,*) delta_t call pgeras call pgenv(0.0,t_max,0.0,100.0,0,0) call pglab('Time (min)','Temperature (C)','Cooling Time') n_steps = int(t_max/delta_t) T = T_ini call pgsci(2) do i=1,n_steps time = i*delta_t T = T - r*(T-Ts)*delta_t if (T.le.45.0) call pgsci(3) call pgpt (1,time,T,-1) end do call pgsci(1) 102 write (*,*) 'Again ? (1=YES;0=NO)' read (*,*) i_again if (i_again.eq.1) goto 100 if (i_again.ne.0) goto 102 call pgclos end