basics of programming

Views:
 
Category: Entertainment
     
 

Presentation Description

No description available.

Comments

By: nitinrola (16 month(s) ago)

nice work

By: sirj (18 month(s) ago)

bdia ppt h venky...........!!!!!!!!!!

Presentation Transcript

Slide 1: 

BASIC CONCEPTS OF PROGRAMMING BY: ARCHANA YADAV B.C.A 3RD SEM(EVEN) ENROL.NO.02021402009

CONTENTS : 

CONTENTS Constants Variable Keywords used in “OOPs” Data types Features of OOPs Difference between “OOPs and POP”

Slide 3: 

Constants Constants have fixed value. Constants, like variables, contain data type. Integer constants are represented as decimal notation, octal notation, and hexadecimal notation. Decimal notation is represented with a number. Octal notation is represented with the number preceded by a zero character. A hexadecimal number is preceded with the characters 0x. Example 1.80 represent decimal 2.0115 represent octal 3.0x167 represent hexadecimal The unsigned integer constant is represented with character u. The long integer constant is represented with character l. .

Slide 4: 

Example: 78 represent int 85u represent unsigned int 78l represent long Floating point constants are numbers with decimal point and/or exponent. Example 2.1567 4.02e24 These examples are valid floating point constants. Floating point constants can be represented with f for floating and l for double precision floating point numbers.

Slide 5: 

Variables A variable is the storage location in memory that is stored by its value. A variable is identified or denoted by a variable name. The variable name is a sequence of one or more letters, digits or underscore. Rules for defining variable name: 1.A variable name can have one or more letters or digits or underscore for example character 2.White space, punctuation symbols or other characters are not permitted to denote variable name. 3.A variable name must begin with a letter. 4.Variable names cannot be keywords or any reserved words of the C++ programming language. 5.C++ is a case-sensitive language. Variable names written in capital letters differ from variable names with the same name but written in small letters.

Slide 6: 

. For Example, The variable name FORTIS differs from the variable name fortis. As previously explained, a variable is the storage location in memory that is stored by variable value. The amount of memory allocated or occupied by each variable differs as per the data stored. The amount of memory used to store a single character is different from that of storing a single integer. A variable must be declared for the specific data type.

Slide 7: 

KEYWORDS The keywords implement specific c++ language features. They are explicitly reserved identifier and cannot be used as names for the program variables or other user-defined elements. asm auto break case catch char class const continue default delete do double else enum extern float for friend goto if inline int long new operator private protected public register return shortort signed sizeof static struct switch template this throw try typedef union unsigned virtual void volatile while

Data type : 

Data type User-defined Built-in type Derived type Structure Union Class enumeration Array Function Pointer Reference Integral type void Floating int char double float

Slide 9: 

-128 to 127 0 to 255 -128 to 127 -32768 to 32767 0 to 65535 -32768 to 32767 -32768 to 32767 0 to 65535 -2147483648 to 2147483647 -2147483648 to 2147483647 0 to 4294967295 3.4E-3.8 to 3.4E+38 1.7E-308 to 1.7E+308 3.4E-4932 to 1.1E+4932 char unsigned char signed char int unsigned int signed int short int unsigned short int signed short int long int signed long int unsigned long int float double long double 1 1 1 2 2 2 2 2 2 4 4 4 4 8 10 Type Bytes Range

Data types : 

Data types Below is a list of the most commonly used Data Types in C++ programming language: short int int long int float double long double char bool short int : This data type is used to represent short integer. int: This data type is used to represent integer. long int: This data type is used to represent long integer. float: This data type is used to represent floating point number.

Slide 11: 

double: This data type is used to represent double precision floating point number. long doubleThis data type is used to represent double precision floating point char: This data type is used to represent a single character. Bool: This data type is used to represent boolean value. It can take one of two values: True or False. Using variable names and data type, we shall now learn how to declare variables.

Slide 12: 

Declaring Variable: In order for a variable to be used in C++ programming language, the variable must first be declared. The syntax for declaring variable names is: data type variable name; The date type can be int or float or any of the data types listed above. A variable name is given based on the rules for defining variable name (refer above rules).

Slide 13: 

Example: int a; This declares a variable name a of type int. If there exists more than one variable of the same type, such variables can be represented by separating variable names using comma. For instance int x,y,z; This declares 3 variables x, y and z all of data type int. The data type using integers (int, short int, long int) are further assigned a value of signed or unsigned. Signed integers signify positive and negative number value. Unsigned integers signify only positive numbers or zero. For example it is declared as unsigned short int a; signed int z; By default, unspecified integers signify a signed integer.

Slide 14: 

Example: int a; is declared a signed integer It is possible to initialize values to variables: data type variable name = value; Example: int a=0; int b=5

Features of oops : 

Features of oops Class Object Instance Method Message passing Inheritance Data abstraction Encapsulation Polymorphism Decouplin Dynamic binding

Slide 16: 

Class Objects are variables of the type class. Once a class has been defined ,we can create number of objects belonging to that class. A class is thus a collection of objects of similar type. Classes are user-defined data types and behave like a built-in types of a programming language. One might say that a class is a blueprint or factory that describes the nature of something. Example: Mango , Apple and orange are members of the class fruit. Syntax: Fruit mango; Will create an object mango belonging to the class fruit

Slide 17: 

Object Objects are the basic run-entities in an object-oriented system.They may represent a person ,a place, a bank account, a table of data or any item that the program has to handle. They may also represent user-defined data such as vectors , time and lists. When a program is executed, the object interact by sending message to one another. Representation of an object Object: STUDENT DATA Name Date-of-birth Marks FUNCTIONS Total Average Display STUDENTS Total Average Display

Slide 18: 

Instance One can have an instance of a class or a particular object. The instance is the actual object created at runtime. In programmer jargon, the Lassie object is an instance of the Dog class. The set of values of the attributes of a particular object is called its state. Method An object's abilities. In language, methods (sometimes referred to as "functions") are verbs. Lassie, being a Dog, has the ability to bark. So bark() is one of Lassie's methods. She may have other methods as well, for example sit() or eat() or walk() or save_timmy(). Within the program, using a method usually affects only one particular object; all Dogs can bark, but you need only one particular dog to do the barking.

Slide 19: 

Message passing "The process by which an object sends data to another object or asks the other object to invoke a method." Also known to some programming languages as interfacing. The process of programming in an object oriented language,therefore,involves the following basic steps: 1.Creating classes that define objects and their behaviour 2.Creating objects class definitions 3.Establishing communication among objects Example: employee.salary(name); message object information

Slide 20: 

Inheritance"Subclasses" are more specialized versions of a class, which inherit attributes and behaviours from their parent classes, and can introduce their own. Inheritance is the process by which objects of one class acquire the properties of objects of another class . It supports the concept of hierarchical classification. Bird Attributes Feathers Lay eggs Non flying birds Flying birds Robin Sparrow Penguin Kiwi

Slide 21: 

Abstraction Abstraction is simplifying complex reality by modelling classes appropriate to the problem, and working at the most appropriate level of inheritance for a given aspect of the problem. Abstraction refers to the act of representing essential features without including the background details or explanations. Classes use the concept of abstraction and are defined as a list of abstract attributes such as size, weight and so on.. They encapsulate all the essential properties of objects that are to be created. The attributes are sometimes called data members because they hold information. Since the classes use the concept of data abstraction ,they are known as abstract data types(ADT)

Slide 22: 

Encapsulation Encapsulation conceals the functional details of a class from objects that send messages to it. The wrapping up of data and functions into a single unit is known as encapsulation. Data encapsulation is the most striking feature of a class.

Slide 23: 

Polymorphism Polymorphism is another important 00P concept. Polymorphism means the ability to take more than one form .An operation may exhibit different behaviour in different instance. The behaviour depends upon the type of data used in the operation. Polymorphism plays an important role in allowing objects having different internal structures to share the same external interface. shape Draw() Triangle object Draw(triangle) Circle object Draw(circle) Box object Draw(box)

Slide 24: 

Decoupling Decoupling allows for the separation of object interactions from classes and inheritance into distinct layers of abstraction. A common use of decoupling is to polymorphically decouple the encapsulation, which is the practice of using reusable code to prevent discrete code modules from interacting with each other. However, in practice decoupling often involves trade-offs with regard to which patterns of change to favor. The science of measuring these trade-offs in respect to actual change in an objective way is still in its infancy.

Dynamic binding : 

Dynamic binding Dynamic binding means that the code associated with a given procedure call is not known until the time of the call at run-time. It is associated with polymorphism and inheritance. Association of function call with function code is known as binding . When the function is associated with function call at compile time then the binding is known as compile time or early binding or static binding. When the function code is associated with function call at run time then the binding is known as dynamic binding or run time binding or late binding.

Difference b/w oops and pop : 

Difference b/w oops and pop In OOP, larger programs are divided into objects. In OOP mostly the data is private and only functions inside the object can access the data. In POP, larger programs are divided into functions In POP, most functions share global data i.e data move freely around the system from function to function. OOPs POP

Difference b/w oops and pop : 

Difference b/w oops and pop OOPs follows a bottom up approach in problem solving. In OOPs, adding of data and function is easy. In OOPs there are public, private and protected specifier. POP follows a top down approach in problem solving . In POP, adding of data and function is difficult In POP, there is no access specifier OOPs POP

Difference b/w oops and pop : 

Difference b/w oops and pop Example of oops is: java, C# In OOPs, operator can be overloaded. In OOPs objects communicate with each other through member functions Example of pop is :c,fortran In POP, operator cannot be overloaded In POP, Data moves openly around the system from function to function, OOPs POP

Difference b/w oops and pop : 

Difference b/w oops and pop In OOPs, importanc5e is given to the data. In OOPs “NEW” operator is used to allocate the memory at run time. In POP, importance is given to the sequence of things to be done i.e. algorithms . In POP ”MALLOC & CALLOC” operator is used to allocate the memory at run time. OOPs POP

Difference b/w oops and pop : 

Difference b/w oops and pop In OOPs the concept of inline function is being used. OOPs deals with the blocks of the problem. In POP no such type of concept used. POP focuses on the steps required to produce the desired outcome. OOPs POP

QUESTIONS ?

Slide 32: 

THANK YOU FOR PAYING YOUR ATTENTION