Professional Documents
Culture Documents
Handout-1 CSM-1101 24.02.2021
Handout-1 CSM-1101 24.02.2021
Objectives:
To learn about problem solving methods.
To learn about different programming paradigms
To learn about need of object oriented programming
To learn about procedural languages.
To learn about object oriented approach
To learn about characteristics of object oriented languages
To learn about difference between C , C++ and Java.
There three methods for solving any problem which are explained below:
1
Solution : sum=a +b + c +d +e
Average=sum/5
Test : (5+7+11+12+15)/5 =10
What is algorithm?:
Algorithm is a step by step method for solving any problem.
Procedural Paradigm:
In procedure – oriented programming more emphasis is given on function not on data.
In this data moves openly around the system from function to function
In this large programs are divided into smaller programs known as procedures.
Languages using this paradigm are called procedural or imperative languages.
FORTRAN, BASIC, Pascal, Ada and C, are all examples of these languages.
2
C++ is another object –oriented language that was developed in 1985. C++ is not a
“pure” object-oriented language as is Smalltalk, but it fits the paradigm in that its data
structures are objects. In fact C++ is actually a superset of C.
Another object-oriented language that is gaining enormous popularity is JAVA. In
JAVA, objects in different computer systems can communicate through the
networking capability provided by the language.
The function f(x) is the algebraic sum of three other functions 2.3x2, 7.4 sin x and cos (3.4x).
Each of these is a function of other function. For example 2.3x2 is a function consisting of
the product of the square of x, a function, and the floating- point number 2.3
The following diagram represents this as a black box.
2.3 x2
f(x)
-7.4sin x add
Cos(3.4x)
In this example, the primitive functions consists of the three floating-point constants
and the variables x.
A set of primitive functions including arithmetic, logical operations and special
functions is described by these types of languages.
Examples of functional programming languages are LISP, APL, HASKEL,
scheme etc.
A principal property of functional languages is the prohibition of assignment
operation.
They use mathematical-styled functions, conditional expressions and recursion.
Extensive use of recursion makes looping structures such as while and for loops
unnecessary.
3
relationships. Declarative languages are concerned more with “what” to do as
opposed to “how” to do it. This mode of reasoning is called logic paradigm.
The most popular declarative language is PROLOG (PROgramming LOGic). It has
wide appeal in artificial intelligence and expert systems.
Another well-known declarative language is SNOBOL4 (StriNg Oriented symBOlic
Language), developed in 1960.
Declarative languages are particularly suitable for database management system. SQL
(Structured Quary Language) is another example of declarative language.
4
Comparison between C, C++ and Java: