Fortran文件读取出错!!
programAAAimplicitnoneinteger::i,points,points2real::stepreal,allocatable::xp(:),yp(:...
program AAAimplicit none integer :: i,points,points2 real :: step real,allocatable :: xp(:),yp(:),xpt(:),ypt(:) write(*,*)"原始点数?" read(*,*)points allocate(xp(points),yp(points)) open(12,file='input.txt',status='old') do i=1,points read(12,“(f7.2,4x,f6.4)")xp(i),yp(i) end do close(12) write(*,*)"插值点阵X轴步长?" read(*,*)step points2=int((xp(points)-xp(1))/step)+1 allocate(xpt(points2),ypt(points2)) xpt(1)=xp(1) do i=2,points2 xpt(i)=xpt(i-1)+real(i-1)*step end do call subspline(points,xp,yp,points2,xpt,ypt) open(10,file='out.txt',status='replace') do i=1,points2 write(10,"(f7.2,4x,e7.5)")xpt(i),ypt(i) end do
close(10) pause stop end program
input.txt文件如下图
编译完成后执行程序显示
我把 read(12,“(f7.2,4x,f6.4)")xp(i),yp(i)改成 read(12,*)xp(i),yp(i)以后又提示
我用的是VS2008+IVF11.1** 展开
close(10) pause stop end program
input.txt文件如下图
编译完成后执行程序显示
我把 read(12,“(f7.2,4x,f6.4)")xp(i),yp(i)改成 read(12,*)xp(i),yp(i)以后又提示
我用的是VS2008+IVF11.1** 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询