LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-01-2011, 08:16 PM   #1
Zssfssz
Member
 
Registered: Sep 2011
Location: Las Vegas!
Distribution: Ubuntu n' Flavors, ReactOS, MINIX3, FreeDOS, Arch
Posts: 339

Rep: Reputation: Disabled
Fortran, Stupid Questions


Ok these thing would seem trivial for a math-geared language but my book didn't say anything.
How do I preform simple mathematics withought PARAMATER these might still need to vary.
Also how do I assine a integer a value withought PARAMAYER as these would still need to vary.
Sorry! Used to the C/C++ way of just using parathses and that doesnt seem to work.
 
Old 12-02-2011, 02:49 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,856
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
Have you googled for "example fortran"?

http://en.wikibooks.org/wiki/Fortran/Fortran_examples
 
Old 12-02-2011, 04:30 AM   #3
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Here is a very basic introduction to Fortran I suggest to our novices: http://www.dur.ac.uk/resources/its/i...8fortran90.pdf. The issue is about basic Fortran syntax: if you need to define a PARAMETER, that is a constant use the PARAMETER attribute, otherwise declare a variable without it, e.g.
Code:
PROGRAM TEST
  IMPLICIT NONE
  INTEGER, PARAMETER :: constant = 5
  INTEGER :: variable, i
  DO i = 1, 10
    variable = i + constant
    WRITE(*,*) 'My variable now is ', variable
  END DO
END PROGRAM TEST
 
Old 12-02-2011, 08:52 AM   #4
Zssfssz
Member
 
Registered: Sep 2011
Location: Las Vegas!
Distribution: Ubuntu n' Flavors, ReactOS, MINIX3, FreeDOS, Arch
Posts: 339

Original Poster
Rep: Reputation: Disabled
Oooooohhhhhh!
That works! For some reason I can't assine variables in the top ~12 lines of my program.
That got me really confused. There was also an error multiplying a number in a 2d array.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stupid questions DarkNeo Debian 2 08-31-2005 09:42 AM
Stupid Questions zinggniz Linux - Newbie 12 10-26-2004 10:01 PM
A few stupid questions... Eyemarten Linux - Newbie 10 04-27-2004 05:07 PM
Stupid Questions - Help!!! bfloeagle Linux - General 11 07-04-2001 09:13 PM
And now,some stupid questions Dynamo Linux - Newbie 4 04-30-2001 12:21 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration