English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Is there any advantage to using FORTRAN over C++?

I'm asking because I am getting a degree in Applied Mathematics and pretty much all of the computer scientists I know are fans of C++ but I've noticed that a lot of engineers tend to use FORTRAN so I'm wondering which would be the most beneficial for me to invest the time to learn more about.

2007-09-04 06:50:36 · 11 answers · asked by Anonymous in Science & Mathematics Engineering

11 answers

First, nobody says you have to learn one or the other--learn both! Your job will usually dictate what language you use. So far I've had to program in Fortran, Quick Basic, Visual Basic, PV-Wave, IDL, Matlab, Perl....all because different jobs had different requirements. Fortran has been around forever and there is little chance that it will be supplanted anytime soon. It's still the language of choice for large numerical projects--I'm talking about things like fluid dynamics and numerical weather prediction. You can do those things in languages like C++ but you'd have to re-invent things that Fortran has built-in.

On the other hand, if you're doing some smaller scientific data process task, you'll probably use Matlab or something of that ilk. One answerer suggested you learn one of those languages instead, but they're not really alternatives. Matlab is great for quickly coding up some data analysis and displaying the results, but nobody's going to write a major scientific application using it, it's WAY too slow.

By the way, it doesn't matter that much what you learn, as long as you're adaptable and don't object to learning new things. I haven't taken a single programming class in my life, but somehow I've managed to muddle along doing it when I have to, just read and most importantly--steal code!!

2007-09-04 08:48:26 · answer #1 · answered by pegminer 7 · 6 0

You may be more comfortable with Fortran. Java and C++ are very similar in various ways. For example, Java was developed based on the C/C++ syntax, so of course there are huge similarities. Fortran is older, but still has the same basic procedural constructs as any programming language: step by step do this then do that. A beginning programming class will cover the beginner's material anyway, regardless of the specifics of the language. You are trying to learn the basic concepts of programming in general.

2016-05-21 02:36:39 · answer #2 · answered by Anonymous · 0 0

At my school they require us to take a computer language and the two choices are FORTRAN and C++. I took C++ and I'm glad I did because I use it much more regularly than I would have FORTRAN. If projects are given involving a computer program most professors will allow you to use whichever program you like so in that respect there is no advantage. I like C++ better because I can use visual basic for it which makes viewing the program much easier and because MATLAB (A program that uses a language very similar to C++) is used a lot in engineering applications. I've found that people who knew C++ picked up MATLAB with no problems and FORTRAN students had a lot harder time because the programming isn't very similar. Bottom line, I'd recommend C++

2007-09-04 06:59:55 · answer #3 · answered by Matt C 3 · 2 0

FORTRAN is aging, and as with any language, once it starts aging it looses its support. FORTRAN language is better designed for optimization by the software that turns code into machine instructions (i.e. compilers). However, as fewer companies are keeping compilers up-to-date, the compilers aren't as good as they could be, or used to be, and the newer "high-level" languages overcome the lower level ones.

As for speed - do you really care? Will speed be an issue? Only you can answer.

Probably more help for C++ on the web. Both languages are being eclipsed by Java and C#.

How will you use it? If you want a supportable application, probably C++ wins out. Both C# and Java can call your C++ stuff pretty easily.

I would recommend a tool like mathcad / mathlab. These tools generally export into dlls or classes, and can be used natively. You can also be sure they are "tested". Always remember no computer can store two-fifths (2/5). (Binary math). If you are working with really big and small numbers, or lots of operations, you must use very very good software.

2007-09-04 09:44:22 · answer #4 · answered by SWEngr 3 · 0 0

I am neither an engineer nor a computer scientist. I have found Fortran to be much easier and more efficient than C++ for my purposes. However, for some formatting purposes and character manipulations, C++ may be better. If you're majoring in Applied Mathematics, Fortran is definitely a better choice.

2007-09-04 07:12:00 · answer #5 · answered by cidyah 7 · 0 0

FORTRAN will generate more efficient code for purely number crunching operations. C++ is a bit bloated by the use of object oriented concepts, and does not always produce the tightest machine code.

I would suggest C as an alternative to FORTRAN as a more modern language that is also very efficient.

2007-09-04 08:07:31 · answer #6 · answered by dansinger61 6 · 2 0

As some people have mentioned, it depends on what you want to do with it. If the program is huge, and does a lot of math, compiled fortran will be much faster. For a simple problem, the use of other packages, C++, Matlab are helpful because they are easy to use.

2007-09-04 10:24:36 · answer #7 · answered by supastremph 6 · 0 0

Fortran is a "high level" language and C++ is a "medium level" language.

What this means is that Fortran looks much more like english that humans use, and C++ is much more like the machine language that computers use. Machine language itself is nothing more than long strings of integers between 0 and 255. Assembly language is a "low level" attempt to make things easier for programmers, but the commands are so primitive it takes dozens of instructions to simply print a single line of text. C++ is a "library" of Assembler routines which have been standardized, and although it still does not look like english, it is far quicker to program in C++. Fortran looks a lot like english (there is an actual "print" statement) and complicated programs can be developed very quickly with a minimum of programming.

However, there is a tradeoff. As languages move up from raw machine code to english syntax, the coding becomes more and more standardized. In other words, one is trading flexability for user friendliness. Programming in the BASIC language is almost as easy as writing an essay, but an operating system like Microsoft Windows would be impossible to write in BASIC. Fortran is basically (sic) BASIC with a robust array of mathematical functions built into it. This is why it is used by many Engineers who don't have the desire to earn a second degree in computer science to be able to use computers.

Low level languages are best used to develop graphical applications and/or the assembler code needed by the chips on the video cards which drive them. Hence, most operating systems are written in C++, with assembler added to speed up program execution. High level langues are de-compiled back into machine code prior to execution. The more similar the language is to machine code, the faster the program runs. This is why video games are highly dependant on assembly language. One other area of engineering which usues a lot of machine code is robotics. These devices use tiny computers to control articulation and a host of other things. These are known as "embedded systems" and all engineers will have to deal with them eventually. However, archetects and draftsmen are more prone to use pre-written packages on pre-compiled operating systems. Autodesk's CAD programs running on Windows is a good example for a design engineer wanting to simply display the dimensions of some part. A civil engineer would probably need something like Fortran to be able to compute the stress on a bridge or building framework. Only software engineers are really reliant on things such as C++ and Assembler. Of course, if it were not for software engineers, the rest of the engineering community would still be using slide rules. (slide rules were non-electronic calculating devices consisting of a graduated sliding bar. In essence, it was a ruler which could calculate. It was only accurate to three decimal places, but very useful in its day).

FYI: about "pointers". Pointers are the hardest thing to learn when it comes to low level languages. A pointer is a variable which contains the address of another variable. It is a very shorthand means of using a "goto" statement. Since computers can't speak, text is nothing more than random strings of integers arranged throught memory. The only way to stitch them all together is using pointers. Text strings are very easy to use in Fortran, but very difficult to handle in C++.

2007-09-04 07:35:38 · answer #8 · answered by Roger S 7 · 3 2

Why use these languages for solving mathematical problems? Use a program specifically designed for this task. Mathcad, Mathematica, or Matlab are three that come to mind.

2007-09-04 07:48:47 · answer #9 · answered by Anonymous · 0 1

Depends on what you want to do with your programming.
FORTRAN is one of the oldest computer languages and I
have used it a lot. It is designed especially for number-
crunching, and if you work mostly with numerical data it is
THE language of choice. If you use character input and non-
numerical format I/O you may prefer to use a form of C.

2007-09-04 07:00:41 · answer #10 · answered by Reginald 7 · 2 0

fedest.com, questions and answers