- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I do not know where is the problem.My code:
program svs
implicit none
integer :: v,x,y
integer,dimension(7,7) :: a
do v=1,10
select case(v)
case(1)
x=-4
y=4
call calcsts(x,y)
call wa(v)
case(2)
x=-3
y=3
call calcsts(x,y)
call wa(v)
case(3)
x=-2.667
y=2.667
call calcsts(x,y)
call wa(v)
case(4)
x=-5
y=5
call calcsts(x,y)
call wa(v)
case(5)
x=-2
y=2
call calcsts(x,y)
call wa(v)
case(6)
x=-3
y=3
call calcsts(x,y)
call wa(v)
case(7)
x=-3
y=3
call calcsts(x,y)
call wa(v)
case(8)
x=-4
y=4
call calcsts(x,y)
call wa(v)
end select
end do
end
subroutine calcsts(x,y)
integer,dimension(7,7) :: a
integer :: i,j
integer,intent(in) :: x,y
do i=1,7
do j=1,6
if (i==j) then
a(i,j)=x
else if ((i-1)==j) then
a(i,j)=y
else
a(i,j)=0
end if
end do
end do
do i=1,7
do j=7,7
a(i,j)=0
end do
end do
end subroutine
subroutine wa(v)
data dfile/'ma .horiz'/
character dfile*10
integer :: id1,id2
integer,input(in) :: v
integer,dimension(7,7) :: a
id1=v/10
id2=v-id1*10
dfile(3:4)=char(id1+48)//char(id2+48)
open(209, file=dfile, form='formatted',status='unknown')
write(209,100)a
100 format(7i3)
end subroutine
program svs
implicit none
integer :: v,x,y
integer,dimension(7,7) :: a
do v=1,10
select case(v)
case(1)
x=-4
y=4
call calcsts(x,y)
call wa(v)
case(2)
x=-3
y=3
call calcsts(x,y)
call wa(v)
case(3)
x=-2.667
y=2.667
call calcsts(x,y)
call wa(v)
case(4)
x=-5
y=5
call calcsts(x,y)
call wa(v)
case(5)
x=-2
y=2
call calcsts(x,y)
call wa(v)
case(6)
x=-3
y=3
call calcsts(x,y)
call wa(v)
case(7)
x=-3
y=3
call calcsts(x,y)
call wa(v)
case(8)
x=-4
y=4
call calcsts(x,y)
call wa(v)
end select
end do
end
subroutine calcsts(x,y)
integer,dimension(7,7) :: a
integer :: i,j
integer,intent(in) :: x,y
do i=1,7
do j=1,6
if (i==j) then
a(i,j)=x
else if ((i-1)==j) then
a(i,j)=y
else
a(i,j)=0
end if
end do
end do
do i=1,7
do j=7,7
a(i,j)=0
end do
end do
end subroutine
subroutine wa(v)
data dfile/'ma .horiz'/
character dfile*10
integer :: id1,id2
integer,input(in) :: v
integer,dimension(7,7) :: a
id1=v/10
id2=v-id1*10
dfile(3:4)=char(id1+48)//char(id2+48)
open(209, file=dfile, form='formatted',status='unknown')
write(209,100)a
100 format(7i3)
end subroutine
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Instead of
integer,input(in) :: v
write
integer, intent(in) :: v
The compiler did tell you which line was in error, did it not?
integer,input(in) :: v
write
integer, intent(in) :: v
The compiler did tell you which line was in error, did it not?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks mecej.I changed code sveral times,lack of concentration.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page