*i made an earlier post to do with my assignment and i managed to get much appreciated help, however i am stuck once again. i am in no way trying to get my homework done or anything like that i just dont understand it. the assignment tells me to 'Within your code you should define an array of your vector TYPE with 5 elements. Your code should then open the supplied .dat file to read in the five vector values' and also nstead of reading in each vector into the array separately, you should instead use a loop from 1 to 5 to read all of the required vectors. This will leave you with a vector array, which will be notated as Vi , where i represents the index of the particular element of the array. You should then perform, and output (with suitable notes output indicating which output is which) the following calculations:
L = V1 + (V2 − V3)
M = V2 ● V4
N = V1 × V5'
so far i have done this and i am more than certain that its wrong id just like a giant push in the right direction thanks.*
program assign_9_2_main
USE assign_9_2_module
type(myvector), dimension(5) :: varray
integer :: i, L, M, N
OPEN(5,FILE='vectors.dat')
READ(5,*) varray(1)
DO i = 1, 5, 1
end do
CLOSE(10)
L=varray(1)+(varray(2)-varray(3))
M=varray(2)*varray(4)
N=varray(1)*varray(5)
write(*,*) L, M, N
end program assign_9_2_main
when i compile it i get an error message saying: L=varray(1)+(varray(2)- varray(3)) 1 Error: Operands of binary numeric operator '-' at (1) are TYPE(myvector)/TYPE(myvector) assign_9_2_main.f90:14.2:
M=varray(2)*varray(4)
1
Error: Operands of binary numeric operator '*' at (1) are TYPE(myvector)/TYPE(myvector)
assign_9_2_main.f90:15.2:
N=varray(1)*varray(5)
1
Error: Operands of binary numeric operator '*' at (1) are TYPE(myvector)/TYPE(myvector).
clearly i'm doing something wrong please can someone help