LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-16-2017, 03:09 PM   #16
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (current), FreeBSD, Win10, It varies
Posts: 9,952

Rep: Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148Reputation: 2148

Quote:
Originally Posted by Laserbeak View Post
Actually FORTRAN isn't that bad. For being the first high level language ever invented (like 1957 or so), it's remarkably similar to modern languages.

The one language I really hate is COBOL, it's worse than reading extremely wordy English. I had to translate a huge system of COBOL programs into Perl and it turned a full huge binder into just a few pages of code.
I wasn't saying it was bad only that it might be a lot different to code it then the others that from what little I've looked into other than seeing some of the code follow c or c++ like writing. therefore logial way of coding it. whereas FORTAIN or COBOL have an entire set of logical ways to write it to get it to do something.. is it not more like assembly like coding?

Hello word in COBOL
Code:
IDENTIFICATION DIVISION.
PROGRAM-ID. HELLO.

PROCEDURE DIVISION.
   DISPLAY 'Hello World'.
STOP RUN.
some FORTAIN
Code:
C AREA OF A TRIANGLE - HERON'S FORMULA
C INPUT - CARD READER UNIT 5, INTEGER INPUT
C OUTPUT - LINE PRINTER UNIT 6, REAL OUTPUT
C INPUT ERROR DISPLAY ERROR OUTPUT CODE 1 IN JOB CONTROL LISTING
      INTEGER A,B,C
      READ(5,501) A,B,C
  501 FORMAT(3I5)
      IF(A.EQ.0 .OR. B.EQ.0 .OR. C.EQ.0) STOP 1
      S = (A + B + C) / 2.0
      AREA = SQRT( S * (S - A) * (S - B) * (S - C) )
      WRITE(6,601) A,B,C,AREA
  601 FORMAT(4H A= ,I5,5H  B= ,I5,5H  C= ,I5,8H  AREA= ,F10.2,
     $13H SQUARE UNITS)
      STOP
      END
and well one should know the rest C and C++ and Java and C# etc do not write like that even.

Last edited by BW-userx; 07-16-2017 at 03:17 PM.
 
Old 07-16-2017, 03:21 PM   #17
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
I recently wrote a FORTRAN program here, and it's not so strange. Of course it's a more modern version of FORTRAN than the original:

Code:
      integer, dimension (1:3) :: v
      integer :: a, b, c, value, vsum
      
      do a = 0, 5, 1
          do b = 0, 9, 1
              do c = 0, 9, 1
                  v(1) = a
                  v(2) = b
                  v(3) = c
                  vsum = sum(v ** 3)
                  value = a * 100 + b * 10 + c
                  if ( value .eq. vsum) then
                      print *, value, " is an Armstrong number"
                  endif
              enddo
          enddo
      enddo
      END
 
Old 07-16-2017, 05:13 PM   #18
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 20 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918
Quote:
Originally Posted by Laserbeak View Post
Actually FORTRAN isn't that bad. For being the first high level language ever invented (like 1957 or so), it's remarkably similar to modern languages.
The first general-purpose one implemented on a large scale perhaps.

See Plankalkül (https://en.wikipedia.org/wiki/Plankalk%C3%BCl), Short Code (https://en.wikipedia.org/wiki/Short_...uter_language)), and the earliest Autocode (https://en.wikipedia.org/wiki/Autocode) for examples of previously-invented high-level languages.
 
Old 07-16-2017, 08:24 PM   #19
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
Quote:
Originally Posted by hydrurga View Post
The first general-purpose one implemented on a large scale perhaps.

See Plankalkül (https://en.wikipedia.org/wiki/Plankalk%C3%BCl), Short Code (https://en.wikipedia.org/wiki/Short_...uter_language)), and the earliest Autocode (https://en.wikipedia.org/wiki/Autocode) for examples of previously-invented high-level languages.
Well I didn't come up with that statement myself, it is generally considered that. Some of that other code you provided examples of looks suspiciously like some form of assembly. I guess it's a bit dependent on your point-of-view as to what constitutes a true high level language and what doesn't.

In any case, FORTRAN is certainly the oldest high level computer language still in use.
 
Old 07-16-2017, 08:41 PM   #20
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
Quote:
Originally Posted by BW-userx View Post
FORTAIN
Oh and BTW, it is FORTRAN. As in FORmula TRANslator. (or alternatively, translating, etc., there are a lot of variants but translator is the one I hear most often)
 
Old 07-17-2017, 02:14 AM   #21
hydrurga
LQ Guru
 
Registered: Nov 2008
Location: Pictland
Distribution: Linux Mint 20 MATE
Posts: 8,048
Blog Entries: 5

Rep: Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918Reputation: 2918
Quote:
Originally Posted by Laserbeak View Post
Well I didn't come up with that statement myself, it is generally considered that.
Erroneously so, I'm afraid, and doing so produces an over-simplified and incorrect view of history that detracts from the ground-breaking work being carried out by various programmers around the world at the time. The 50s were an amazingly interesting time for high-level language design and development.

Here's a historical summary: https://en.wikipedia.org/wiki/High-l...mming_language

Quote:
Originally Posted by Laserbeak View Post
Some of that other code you provided examples of looks suspiciously like some form of assembly.
Nope. They were high-level languages designed for specific purposes. The Autocodes used compilers. Short Code used an interpreter. Some of the more esoteric programming languages in existence today look just as strange.

Quote:
Originally Posted by Laserbeak View Post
I guess it's a bit dependent on your point-of-view as to what constitutes a true high level language and what doesn't.
Plankalkül, for example, included:

Quote:
assignment statements, subroutines, conditional statements, iteration, floating point arithmetic, arrays, hierarchical record structures, assertions, exception handling, and other advanced features
I thought you (and others) would be interested in learning about the other earlier high-level programming languages. I wasn't having a go at FORTRAN or you, just desiring to show a better picture of what happened at the time in what was one of the most exciting periods in programming history.
 
Old 07-17-2017, 05:46 AM   #22
YesItsMe
Member
 
Registered: Oct 2014
Posts: 711

Rep: Reputation: 274Reputation: 274Reputation: 274
Wink

Quote:
Originally Posted by hazel View Post
everything that is valid in C is valid in C++ too.
It is not.
Valid C but invalid C++:

Code:
int class = 0;
(It is actually awesome to see that some other people than me still talk about COBOL. Thank you, posters above!)
 
Old 07-17-2017, 05:54 AM   #23
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 5,583
Blog Entries: 16

Rep: Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316Reputation: 3316
Quote:
Originally Posted by YesItsMe View Post
It is not.
Valid C but invalid C++:

Code:
int class = 0;
C++ doesn't let you initialise variables when you declare them?

Quote:
(It is actually awesome to see that some other people than me still talk about COBOL. Thank you, posters above!)
Apparently there are huge amounts of legacy COBOL still out there. Companies are desperate to find someone to maintain them.
 
Old 07-17-2017, 05:59 AM   #24
YesItsMe
Member
 
Registered: Oct 2014
Posts: 711

Rep: Reputation: 274Reputation: 274Reputation: 274
Quote:
Originally Posted by hazel View Post
C++ doesn't let you initialise variables when you declare them?
class is a reserved C++ keyword, so it can't be used as a variable name. This is not the case for C which has no classes.

Quote:
Originally Posted by hazel View Post
Apparently there are huge amounts of legacy COBOL still out there.
I like COBOL for its readability. There should be more COBOL and less JavaScript. Or so.
 
Old 07-17-2017, 02:09 PM   #25
lse123
Member
 
Registered: Dec 2008
Posts: 125

Original Poster
Rep: Reputation: 15
C++ is Like Java ONLY-OOP language?
 
Old 07-17-2017, 02:16 PM   #26
YesItsMe
Member
 
Registered: Oct 2014
Posts: 711

Rep: Reputation: 274Reputation: 274Reputation: 274
You can write a valid C++ application without one single object.
 
Old 07-17-2017, 03:56 PM   #27
Laserbeak
Member
 
Registered: Jan 2017
Location: Manhattan, NYC NY
Distribution: Mac OS X, iOS, Solaris
Posts: 508

Rep: Reputation: 143Reputation: 143
Quote:
Originally Posted by YesItsMe View Post
You can write a valid C++ application without one single object.
Yes. Most C programs are valid C++ programs unless they happen to use as a variable or function name something that is a reserved word in C++ like new or delete which are similar to malloc and free in C. You can still use those in C++, but you can't mix them with new and delete, i.e. you can't new a variable then free it. If you new something, you have to delete it and if you malloc something you have to free it, otherwise undefined behavior could occur, like usually your program crashing.

You can use malloc() and free() in C++ exactly the way you would on C regular variables, but you should never use it on C++ objects, because it won't properly call the constructors/destructors of the object properly.

Last edited by Laserbeak; 07-17-2017 at 04:00 PM.
 
Old 07-17-2017, 08:16 PM   #28
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,513

Rep: Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010Reputation: 1010
I would say to learn c++, but learn it correctly, like from a tutorial on oop. You should first learn what objects are, and then what they do. If you learn to think correctly, you'll be able to program correctly.

Otherwise, if you just pick up a reference, you'll develop all kinds of bad programming habits.
 
Old 07-18-2017, 12:57 AM   #29
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,357

Rep: Reputation: 213Reputation: 213Reputation: 213
Quote:
Originally Posted by AwesomeMachine View Post
I would say to learn c++, but learn it correctly, like from a tutorial on oop. You should first learn what objects are, and then what they do. If you learn to think correctly, you'll be able to program correctly.

Otherwise, if you just pick up a reference, you'll develop all kinds of bad programming habits.
Certainly not C++, what will he earn to begin with C++, maybe you can let us know?
 
Old 07-18-2017, 01:27 AM   #30
a4z
Senior Member
 
Registered: Feb 2009
Posts: 1,727

Rep: Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742Reputation: 742
Quote:
Originally Posted by lse123 View Post
C++ is Like Java ONLY-OOP language?
as already written, C++ is a multi paradigm language, and OOP is just one aspect of it

Quote:
Originally Posted by AwesomeMachine View Post
I would say to learn c++, but learn it correctly,
so far so good

Quote:
Originally Posted by AwesomeMachine View Post
like from a tutorial on oop. You should first learn what objects are, and then what they do. If you learn to think correctly, you'll be able to program correctly.
autsch, a horrible advice. you have no idea what you are talking about
 
  


Reply

Tags
c++


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trying to learn more about Linux carrollshaffer Linux - Newbie 20 02-01-2017 05:22 AM
Hi . Someone to learn Linux Lingat04 LinuxQuestions.org Member Intro 1 04-18-2013 09:20 PM
How did you learn Linux? jamescow Linux - General 32 03-19-2009 12:13 AM
how to learn linux senthilk Linux - General 9 05-07-2007 09:50 PM
What's the best way to learn linux? Tech1 Linux - General 19 04-15-2003 09:36 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:25 AM.

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