Random number function problem in Fortran program

  • Topic: Comp Sci 
  • Thread starter Kafros
  • Start date
  • Tags Tags
    Fortran
1 reply · 4K views · last reply
Kafros
Messages
1
Reaction score
0
help with fortran please

i'm new with programming and i have a problem with a homework I've been assigned from university. it's quite a simple programm but I'm stuck and going crazy . can anyone please help. there seems to be a problem with the random function. but i couldn't fix it. I'm using silverfrost ftn95 plato3 ide compiler. the scope of this programm is to calculate the mean value of a sum of random numbers and as a seed is used a default number. i have attached to this post a pic of what the problem appears to be. take a look please and help me if you can. going crazy
 
Attachments
  • Screenshot of the Plato3 Fortran IDE showing source code for program ASKISI1 with a RANDOM call, and an output pane reporting error 283: RANDOM must appear in a type declaration because IMPLICIT NONE is used.
    problem.JPG
    43 KB · Views: 541
Kafros said:
i'm new with programming and i have a problem with a homework I've been assigned from university. it's quite a simple programm but I'm stuck and going crazy . can anyone please help. there seems to be a problem with the random function. but i couldn't fix it. I'm using silverfrost ftn95 plato3 ide compiler. the scope of this programm is to calculate the mean value of a sum of random numbers and as a seed is used a default number. i have attached to this post a pic of what the problem appears to be. take a look please and help me if you can. going crazy

Comments:

* Learn to use comment cards (yes I am that old ;), while it may seem pointless with simple programs it will be of great value in the future (in particular to those looking at your code).
* What happens if the user inputs 5 for N ? You need some error trapping, (i.e. you need to tell them they goofed since N must be between 10 and 100000 and re-request the value of N).
* Is there really a need for a vector (M) and 2 do loops in this program ?
* Since you have declared "Implicit none" how does the compiler to know
(i.e. how do you tell it) that random is a REAL function ?