Programming languages
1 / 7

Programming Languages - PowerPoint PPT Presentation

  • Uploaded on

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 .

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about ' Programming Languages' - kylynn-duran

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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Classification and distinctive features
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

Classification and distinctive features1
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.

Classification and distinctive features2
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

Tracing simple programs in c

#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



Syntax of c

  • Thepreprocessordirective ‘#include<iostream.h>’ canbefoundinalmostallC++programs.Itprovidessubprogramstoprocessstandardinputandstandardoutput.

  • Usecinforstandardinputandcoutforstandardoutput.

  • Declarativestatementscanbeputinanywhereoftheprogrambody.

  • Useapairofdoublequotationmarks(")toencloseastring.

  • Specialcharacters:

    • \t(horizontaltab)

    • \n(newlinecharacter)

    • \\(thebackslash\)

    • \"(thedoublequotationmark")

Data types variables and variable assignment

  • 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: