1 / 7

Programming Languages

Programming Languages. Classification and distinctive features. Procedural Language A term used in contrast to declarative language to describe a language where the programmer specifies an explicit sequences of steps to follow to produce a result .

Download Presentation

Programming Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming Languages

  2. Classification and distinctive features • Procedural Language • A term used in contrast to declarative language to describe a language where the programmer specifies an explicit sequences of steps to follow to produce a result. • Common procedural languages include Basic, Pascal and C. • Declarative Language • Declarative languages describe relationships between variables in terms of functions or inference rules and the language executor (interpreter or compiler) applies some fixed algorithm to these relations to produce a result. • Common declarative languages include logic programming languages such as Prolog

  3. Classification and distinctive features • Object-oriented Language • A programming languages and techniques based on the concept of an "object" which is a data structure (abstract data type) encapsulated with a set of routines, called "methods" which operate on the data. Operations on the data can only be performed via these methods, which are common to all objects, which are instances of a particular "class". • Common declarative languages include C++ and Java.

  4. Classification and distinctive features • Visual Programming • Visual programming environments provides graphical or iconic elements, which can be manipulated by the user in an interactive way according to some specific spatial grammar for program construction. • Common declarative languages include Visual Basic and Visual C++. • Query Language • A language in which users of a database can (interactively) formulate requests and generate reports. The best known is SQL

  5. #include <iostream.h> preprocessor directive(s) main() {  // A simple C++ program  int x, y, sum;  cout << "A program which adds two integers\n";  cout << "Enter 1st integer: ";  cin >> x;  cout << "Enter 2nd integer: ";  cin >> y;  sum = x + y;  cout << "Sum is " << sum << endl;  return 0;} program body TracingsimpleprogramsinC++ AsimpleC++program

  6. syntaxofC++ • Thepreprocessordirective ‘#include<iostream.h>’ canbefoundinalmostallC++programs.Itprovidessubprogramstoprocessstandardinputandstandardoutput. • Usecinforstandardinputandcoutforstandardoutput. • Declarativestatementscanbeputinanywhereoftheprogrambody. • Useapairofdoublequotationmarks(")toencloseastring. • Specialcharacters: • \t(horizontaltab) • \n(newlinecharacter) • \\(thebackslash\) • \"(thedoublequotationmark")

  7. Datatypes,variablesandvariableassignment • Variablesarecase-sensitive. • Commonsimpledatatypes • int(integer) • short(16-bitinteger) • long(32-bitinteger) • char(character) • float(singleprecisionfloating-pointnumber) • double(doubleprecisionfloating-pointnumber) • Thetypemodifierunsignedindicatesthatthevariablecannotholdnegativenumbers. • Thereservedwordtypedefisusedtodefineanewdatatype. • C++usestheequalsign(=)forassignment,e.g. ‘x=4;’.(Use ‘==’ as ‘equalto’ inC++.) • Initialisationcanbedoneinthedeclarativestatements,e.g. ‘intx=4;’ • Mixed-modeassignmentispossible:

More Related