Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need help FORTRAN problem

Status
Not open for further replies.
Jan 27, 2014
3
Please I need help with a program , I need to submit a job

Develop a FORTRAN program that reads a square matrix containing integers from an input file and write it on the screen , using the " open" command. The matrix should be able to store information on up to 10 rows and 10 columns . Then the program should display the on-screen menu options below and let the user choose the options 1,2 or 3.If you choose an invalid option , display the menu again :

1 - multiplication
2 - arithmetic mean
3- exit

Option 1 : Should be called a sub routine that multiplies each row of the matrix element of the secondary diagonal , thus making a new matrix.The new matrix should be sent to the main program and then must be written on the screen

Option 2 : An external function should be used to calculate the arithmetic mean of the elements of the matrix below the diagonal secondary.The result should be sent to the main program and then must be written on the screen.


Tks
 
You are ready to help you a little bit but we don't intent to do your home work

=> how us first what you are able to construct yourself

François Jacq
 
There is a proverb : help yourself and God will help you !

As I am not God, I will give you few advises first (God is not so cute) :

- read a tutorial about Fortran

- the task you have should correspond to less than 100 instructions

- these instructions must belong to 3 procedures : a main program, a subroutine and a function

- the main variables must be created in the main program. You need clearly two integer matrices, an integer option and two integer values containing the two true dimensions of the matrices. Give them the name you want.

Here you have the choice between declaring matrices larger than what you really need, or read first the true dimensions and allocate the matrices at the right size. The text proposes the first alternative but a "modern" programmer would choose the second one.

- the first matrix must be read from a data file. So you need to create that file first (if you don't have it already) using a classical text editor (not Word please ! Just a notepad). Such file should contain a first line providing the true dimension of the matrix. The other lines should contain the values of the matrix organized row by row (easier to read) or column by column (the natural Fortran order). Choose what you want : you have just to take care about the matrix read statement which must be adjusted to the choice done in the data file.

As conclusion, start just by the main program and the data file. Write a simplified version just declaring correctly the first matrix, opening the data file, reading the matrix from the data file and printing it out on screen (WRITE statement). Make that simple program working and this will be a good step of less than 10 instructions.




François Jacq
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top