SlideShare ist ein Scribd-Unternehmen logo
1 von 28
WEL COME
PRAVEEN M JIGAJINNI
PGT (Computer Science)
MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA,
Dc. Sc. & Engg.
Reference Book
CLASS XI
By
Sumita Arora
CHAPTER 13
STRUCTURE
S
INTRODUCTION
In C++ language, custom data types
can be created to meet users
requirements in 5 ways: class,
structure, union, enumeration and
typedef.
Structures are one of the 2 important
building blocks in the understanding of
classes and objects. A structure is a
collection of data and functions. In other
words, we can say, a structure plus
INTRODUCTION
Technically ,there is no difference
between a structure and a class. In
fact , a structure is a class declared
with keyword struct and by default, all
members are public in a structure
whereas all members are private by
default in the class.
STRUCTURES
‱ Sometimes, some logically related elements need
to be treated under one unit. For instance, the
elements storing a student’s information (e.g., roll
no , name, class, marks, grade) need t be
processed together under one roof. Similarly,
elements keeping a date’s information (e.g., day,
month, and year) need to be processed together.
To handle and serve to such situation, C++ offers
structures.
‱ Thus it can be said that ,
‱ A C style structures is a collection of variables
referenced under one name.
STRUCTURES
‱ To handle and serve to such situation,
C++ offers structures.
‱ Thus it can be said that ,
‱ A C style structures is a collection of
variables referenced under one name.
STRUCTURES
‱ The following code fragment shows
how to define a structure (say date).
The keyword struct tells the compiler
that a structure is being defined.
Struct date { short day;
short month;
short year;};
REFRERENCING
STRUTUERE ELEMENTS
Once a structure variable has been
defined, its member can be accessed
through the use of (.) the dot operator.
Ex. The code assigns 1740 t the year
element of birth_date structure variable
declared earlier: birth_date.year = 1740;
the structure variable followed by the (.)
& name references to that individual
structure element.
REFRERENCING
STRUTUERE ELEMENTS
The structure members are just treated
like other variables. Therefore to print
year of birth_date we can write
cout<<birth_date.year;
Initializing Structure
Elements
Structure can be initialized separately
or jointly . Member of structure
senior_student
can be initialized as separately:
senior_student.rolln=01;
senior_student.class=12;
senior_student.marks=50;
senior_student.grade=A
Initializing Structure
Elements
Or jointly as:
Stutype senior_student = { 01 ,12 ,50 ,A };
Joint structure can not be used befour the
variables are defined.
Structure
Assignment
Objects of the same structure can be
assign
or passed as a function .
Ex. The members of senior_student can
be assign to junior_student.
Structure Assignment
Two structure types are different ven they
have same members.
Struct one { int a ;
};
Struct two{int a;
};
one s1 ;
two s2;
cin >> s1.a; //read s1
s2=s1 //error :type
mismatch
The code will produce an error because both are of different type.
NESTED STRUCTURE
A structure element may be either
complex or simple .the simple elements
are int, char, float double .
Element of structure may contain
structure in itself known as complex
structure.
ACCESSING NESTED
STRUCTURE MEMBER
The member of structure can be accessed
by using dot operator . To access the city
member of address which is the element
of other structure worker, we shall write:
Worker.address.city
STRUCTURE AND
ARRAYS
Structure and arrays are both
derived types. Arrays are the collection
of analogous elements,
structures assemble dissimilar
elements under one roof. Both can be
combined to form compels data objects.
ARRAYS OF STRUCTURE
An array can contain similar elements,the
combination having structures within an array is
an array of structure .To declare an structure tou
must define a structure and then declare an
array variable of that type.
To declare a 100 element array of structure of type
addr men_addr [100] ;
To access a specific structure ex . to print houseno of structure 8
write
cout << mem_add [7].houseno ;
Passing structure to
function
Passing a local structure to a function can
be done in two ways:
1.By passing individual structure element
2. By passing the entire structure.
Passing structure
elements to function
When an element of structure is passed
to a function, actually a value of that
element to that function is passing . It is
just like passing the simple variable.
Passing entire structure makes sense
when structure is relatively compact.
The entire function can be passed by
value or by reference.
Returning structure
from function
Just like other types , function can
return structure also. Then the type of
the function is the same as that of
structure returned.
User defined data type
‱ C++ allows you to define new type of
data types name by using keyword
typedef
‱ Typedef does not create new data
class rather it define new name for
an existing type.
‱ Ex typedef float amount
#Define Pre-Processor
Directive
Pre-processor commands are called
DIRECTIVES and begins with a pound
symbol.(#). Many things that can be
done during pre-processor phase
include:
Inclusion of other files through #include
directive.
Definition of symbolic constants and
macros through #define directive.
#Define Pre-Processor
Directive
‱ The preprocessing phase of a c++
program occurs befour a program is
compiled . The c++ peprocessor is a
program that is executed befour the
source code is compiled.
#Define Pre-Processor
Directive
‱ The preprocessor allows us to define
symbolic names and constants. Ex .
‱ 1. #define I 3.14159
‱ 2.#define MAX 70
Macros are built on #define preprocessor
A micro define would be
#define SQUARE (x) x*x
#Define Pre-Processor
Directive
The difference is of constant and
expression.
#include <iostream.h>
#define square (x) x*x
Void main()
{int value=3;
cout << square (value);
}
After preprocessing the code would become
Void main()
{int value =3;
Cout <<value*value}
#Define Pre-Processor
Directive
A few things that must be known about macros
A macro without argument is treated like
symbolic constant.
A micro substitutes text only ; it does not
check for data type.
While defining macros ,make sure you use
parenthesis.
#define CIRLE_AREA(X) PI*X*X
area =CIRLE_AREA(C+2);
IT WOULD BE EXPANDED AS
area =3.14159*C+2*C+2;
THANK
YOU

Weitere Àhnliche Inhalte

Was ist angesagt?

C programing -Structure
C programing -StructureC programing -Structure
C programing -Structureshaibal sharif
 
Unit 9. Structure and Unions
Unit 9. Structure and UnionsUnit 9. Structure and Unions
Unit 9. Structure and UnionsAshim Lamichhane
 
Presentation on c programing satcture
Presentation on c programing satcture Presentation on c programing satcture
Presentation on c programing satcture topu93
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries InformationNishant Munjal
 
Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Abou Bakr Ashraf
 
Database Design and Normalization Techniques
Database Design and Normalization TechniquesDatabase Design and Normalization Techniques
Database Design and Normalization TechniquesNishant Munjal
 
Introduction to odbms
Introduction to odbmsIntroduction to odbms
Introduction to odbmsajay pashankar
 
9. Object Relational Databases in DBMS
9. Object Relational Databases in DBMS9. Object Relational Databases in DBMS
9. Object Relational Databases in DBMSkoolkampus
 
Object Oriented Dbms
Object Oriented DbmsObject Oriented Dbms
Object Oriented Dbmsmaryeem
 
Sv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvmSv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvmHARINATH REDDY
 
2 data structure in R
2 data structure in R2 data structure in R
2 data structure in Rnaroranisha
 
pointer, structure ,union and intro to file handling
pointer, structure ,union and intro to file handlingpointer, structure ,union and intro to file handling
pointer, structure ,union and intro to file handlingRai University
 
Lk module4 structures
Lk module4 structuresLk module4 structures
Lk module4 structuresKrishna Nanda
 

Was ist angesagt? (20)

C programing -Structure
C programing -StructureC programing -Structure
C programing -Structure
 
Unit 9. Structure and Unions
Unit 9. Structure and UnionsUnit 9. Structure and Unions
Unit 9. Structure and Unions
 
Structure in C
Structure in CStructure in C
Structure in C
 
Presentation on c programing satcture
Presentation on c programing satcture Presentation on c programing satcture
Presentation on c programing satcture
 
12 SQL
12 SQL12 SQL
12 SQL
 
SQL Queries Information
SQL Queries InformationSQL Queries Information
SQL Queries Information
 
Structures in c++
Structures in c++Structures in c++
Structures in c++
 
Visula C# Programming Lecture 6
Visula C# Programming Lecture 6Visula C# Programming Lecture 6
Visula C# Programming Lecture 6
 
Database Design and Normalization Techniques
Database Design and Normalization TechniquesDatabase Design and Normalization Techniques
Database Design and Normalization Techniques
 
Introduction to odbms
Introduction to odbmsIntroduction to odbms
Introduction to odbms
 
Data Types
Data TypesData Types
Data Types
 
9. Object Relational Databases in DBMS
9. Object Relational Databases in DBMS9. Object Relational Databases in DBMS
9. Object Relational Databases in DBMS
 
Object Oriented Dbms
Object Oriented DbmsObject Oriented Dbms
Object Oriented Dbms
 
Sql fundamentals
Sql fundamentalsSql fundamentals
Sql fundamentals
 
Sv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvmSv data types and sv interface usage in uvm
Sv data types and sv interface usage in uvm
 
02 data types in java
02 data types in java02 data types in java
02 data types in java
 
2 data structure in R
2 data structure in R2 data structure in R
2 data structure in R
 
cs8251 unit 1 ppt
cs8251 unit 1 pptcs8251 unit 1 ppt
cs8251 unit 1 ppt
 
pointer, structure ,union and intro to file handling
pointer, structure ,union and intro to file handlingpointer, structure ,union and intro to file handling
pointer, structure ,union and intro to file handling
 
Lk module4 structures
Lk module4 structuresLk module4 structures
Lk module4 structures
 

Andere mochten auch

+2 Computer Science - Volume II Notes
+2 Computer Science - Volume II Notes+2 Computer Science - Volume II Notes
+2 Computer Science - Volume II NotesAndrew Raj
 
Ch 07 understanding marginalsisation1
Ch 07 understanding  marginalsisation1Ch 07 understanding  marginalsisation1
Ch 07 understanding marginalsisation1Praveen M Jigajinni
 
CBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationCBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationGuru Ji
 
Communication Technology- Information System and Technologies
Communication Technology- Information System and TechnologiesCommunication Technology- Information System and Technologies
Communication Technology- Information System and TechnologiesFaindra Jabbar
 
CBSE XII Communication And Network Concepts
CBSE XII Communication And Network ConceptsCBSE XII Communication And Network Concepts
CBSE XII Communication And Network ConceptsGuru Ji
 

Andere mochten auch (7)

+2 Computer Science - Volume II Notes
+2 Computer Science - Volume II Notes+2 Computer Science - Volume II Notes
+2 Computer Science - Volume II Notes
 
Ch 07 understanding marginalsisation1
Ch 07 understanding  marginalsisation1Ch 07 understanding  marginalsisation1
Ch 07 understanding marginalsisation1
 
14 Communication Concepts
14 Communication Concepts14 Communication Concepts
14 Communication Concepts
 
13 Boolean Algebra
13 Boolean Algebra13 Boolean Algebra
13 Boolean Algebra
 
CBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL PresentationCBSE XII Database Concepts And MySQL Presentation
CBSE XII Database Concepts And MySQL Presentation
 
Communication Technology- Information System and Technologies
Communication Technology- Information System and TechnologiesCommunication Technology- Information System and Technologies
Communication Technology- Information System and Technologies
 
CBSE XII Communication And Network Concepts
CBSE XII Communication And Network ConceptsCBSE XII Communication And Network Concepts
CBSE XII Communication And Network Concepts
 

Ähnlich wie Structures

Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures topu93
 
Chapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfChapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfTamiratDejene1
 
Unit 4 qba
Unit 4 qbaUnit 4 qba
Unit 4 qbaSowri Rajan
 
Structures and Pointers
Structures and PointersStructures and Pointers
Structures and PointersPrabu U
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++Jeff TUYISHIME
 
Chapter 13.1.9
Chapter 13.1.9Chapter 13.1.9
Chapter 13.1.9patcha535
 
Structures in c++
Structures in c++Structures in c++
Structures in c++Swarup Boro
 
CP Handout#10
CP Handout#10CP Handout#10
CP Handout#10trupti1976
 
data structure and c programing concepts
data structure and c programing conceptsdata structure and c programing concepts
data structure and c programing conceptskavitham66441
 
Unit-V.pptx
Unit-V.pptxUnit-V.pptx
Unit-V.pptxMehul Desai
 
Structure In C
Structure In CStructure In C
Structure In Cyndaravind
 
Data Structure & Algorithm - Self Referential
Data Structure & Algorithm - Self ReferentialData Structure & Algorithm - Self Referential
Data Structure & Algorithm - Self Referentialbabuk110
 

Ähnlich wie Structures (20)

Presentation on c structures
Presentation on c   structures Presentation on c   structures
Presentation on c structures
 
Chapter 8 Structure Part 2 (1).pptx
Chapter 8 Structure Part 2 (1).pptxChapter 8 Structure Part 2 (1).pptx
Chapter 8 Structure Part 2 (1).pptx
 
Chapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdfChapter 7 (Part I) - User Defined Datatypes.pdf
Chapter 7 (Part I) - User Defined Datatypes.pdf
 
Unit 4 qba
Unit 4 qbaUnit 4 qba
Unit 4 qba
 
Structures and Pointers
Structures and PointersStructures and Pointers
Structures and Pointers
 
2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++2 lesson 2 object oriented programming in c++
2 lesson 2 object oriented programming in c++
 
Chapter 13.1.9
Chapter 13.1.9Chapter 13.1.9
Chapter 13.1.9
 
Structures in c++
Structures in c++Structures in c++
Structures in c++
 
Programming in C
Programming in CProgramming in C
Programming in C
 
CP Handout#10
CP Handout#10CP Handout#10
CP Handout#10
 
Structure & union
Structure & unionStructure & union
Structure & union
 
01 objective-c session 1
01  objective-c session 101  objective-c session 1
01 objective-c session 1
 
Objects and Types C#
Objects and Types C#Objects and Types C#
Objects and Types C#
 
C structure and union
C structure and unionC structure and union
C structure and union
 
data structure and c programing concepts
data structure and c programing conceptsdata structure and c programing concepts
data structure and c programing concepts
 
structure1.pdf
structure1.pdfstructure1.pdf
structure1.pdf
 
Unit-V.pptx
Unit-V.pptxUnit-V.pptx
Unit-V.pptx
 
Structure In C
Structure In CStructure In C
Structure In C
 
Mca 504 dotnet_unit3
Mca 504 dotnet_unit3Mca 504 dotnet_unit3
Mca 504 dotnet_unit3
 
Data Structure & Algorithm - Self Referential
Data Structure & Algorithm - Self ReferentialData Structure & Algorithm - Self Referential
Data Structure & Algorithm - Self Referential
 

Mehr von Praveen M Jigajinni

Chapter 09 design and analysis of algorithms
Chapter 09  design and analysis of algorithmsChapter 09  design and analysis of algorithms
Chapter 09 design and analysis of algorithmsPraveen M Jigajinni
 
Chapter 08 data file handling
Chapter 08 data file handlingChapter 08 data file handling
Chapter 08 data file handlingPraveen M Jigajinni
 
Chapter 06 constructors and destructors
Chapter 06 constructors and destructorsChapter 06 constructors and destructors
Chapter 06 constructors and destructorsPraveen M Jigajinni
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objectsPraveen M Jigajinni
 
Chapter 04 object oriented programming
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programmingPraveen M Jigajinni
 
Chapter 03 python libraries
Chapter 03 python librariesChapter 03 python libraries
Chapter 03 python librariesPraveen M Jigajinni
 
Chapter 02 functions -class xii
Chapter 02   functions -class xiiChapter 02   functions -class xii
Chapter 02 functions -class xiiPraveen M Jigajinni
 
Chapter 13 exceptional handling
Chapter 13 exceptional handlingChapter 13 exceptional handling
Chapter 13 exceptional handlingPraveen M Jigajinni
 
Chapter 9 python fundamentals
Chapter 9 python fundamentalsChapter 9 python fundamentals
Chapter 9 python fundamentalsPraveen M Jigajinni
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with pythonPraveen M Jigajinni
 
Chapter 7 basics of computational thinking
Chapter 7 basics of computational thinkingChapter 7 basics of computational thinking
Chapter 7 basics of computational thinkingPraveen M Jigajinni
 
Chapter 6 algorithms and flow charts
Chapter 6  algorithms and flow chartsChapter 6  algorithms and flow charts
Chapter 6 algorithms and flow chartsPraveen M Jigajinni
 

Mehr von Praveen M Jigajinni (20)

Chapter 09 design and analysis of algorithms
Chapter 09  design and analysis of algorithmsChapter 09  design and analysis of algorithms
Chapter 09 design and analysis of algorithms
 
Chapter 08 data file handling
Chapter 08 data file handlingChapter 08 data file handling
Chapter 08 data file handling
 
Chapter 07 inheritance
Chapter 07 inheritanceChapter 07 inheritance
Chapter 07 inheritance
 
Chapter 06 constructors and destructors
Chapter 06 constructors and destructorsChapter 06 constructors and destructors
Chapter 06 constructors and destructors
 
Chapter 05 classes and objects
Chapter 05 classes and objectsChapter 05 classes and objects
Chapter 05 classes and objects
 
Chapter 04 object oriented programming
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programming
 
Chapter 03 python libraries
Chapter 03 python librariesChapter 03 python libraries
Chapter 03 python libraries
 
Chapter 02 functions -class xii
Chapter 02   functions -class xiiChapter 02   functions -class xii
Chapter 02 functions -class xii
 
Unit 3 MongDB
Unit 3 MongDBUnit 3 MongDB
Unit 3 MongDB
 
Chapter 17 Tuples
Chapter 17 TuplesChapter 17 Tuples
Chapter 17 Tuples
 
Chapter 15 Lists
Chapter 15 ListsChapter 15 Lists
Chapter 15 Lists
 
Chapter 14 strings
Chapter 14 stringsChapter 14 strings
Chapter 14 strings
 
Chapter 13 exceptional handling
Chapter 13 exceptional handlingChapter 13 exceptional handling
Chapter 13 exceptional handling
 
Chapter 10 data handling
Chapter 10 data handlingChapter 10 data handling
Chapter 10 data handling
 
Chapter 9 python fundamentals
Chapter 9 python fundamentalsChapter 9 python fundamentals
Chapter 9 python fundamentals
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with python
 
Chapter 7 basics of computational thinking
Chapter 7 basics of computational thinkingChapter 7 basics of computational thinking
Chapter 7 basics of computational thinking
 
Chapter 6 algorithms and flow charts
Chapter 6  algorithms and flow chartsChapter 6  algorithms and flow charts
Chapter 6 algorithms and flow charts
 
Chapter 5 boolean algebra
Chapter 5 boolean algebraChapter 5 boolean algebra
Chapter 5 boolean algebra
 
Chapter 4 number system
Chapter 4 number systemChapter 4 number system
Chapter 4 number system
 

KĂŒrzlich hochgeladen

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parentsnavabharathschool99
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 

KĂŒrzlich hochgeladen (20)

Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Choosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for ParentsChoosing the Right CBSE School A Comprehensive Guide for Parents
Choosing the Right CBSE School A Comprehensive Guide for Parents
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPSÂź Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 

Structures

  • 1. WEL COME PRAVEEN M JIGAJINNI PGT (Computer Science) MCA, MSc[IT], MTech[IT],MPhil (Comp.Sci), PGDCA, ADCA, Dc. Sc. & Engg.
  • 4. INTRODUCTION In C++ language, custom data types can be created to meet users requirements in 5 ways: class, structure, union, enumeration and typedef. Structures are one of the 2 important building blocks in the understanding of classes and objects. A structure is a collection of data and functions. In other words, we can say, a structure plus
  • 5. INTRODUCTION Technically ,there is no difference between a structure and a class. In fact , a structure is a class declared with keyword struct and by default, all members are public in a structure whereas all members are private by default in the class.
  • 6. STRUCTURES ‱ Sometimes, some logically related elements need to be treated under one unit. For instance, the elements storing a student’s information (e.g., roll no , name, class, marks, grade) need t be processed together under one roof. Similarly, elements keeping a date’s information (e.g., day, month, and year) need to be processed together. To handle and serve to such situation, C++ offers structures. ‱ Thus it can be said that , ‱ A C style structures is a collection of variables referenced under one name.
  • 7. STRUCTURES ‱ To handle and serve to such situation, C++ offers structures. ‱ Thus it can be said that , ‱ A C style structures is a collection of variables referenced under one name.
  • 8. STRUCTURES ‱ The following code fragment shows how to define a structure (say date). The keyword struct tells the compiler that a structure is being defined. Struct date { short day; short month; short year;};
  • 9. REFRERENCING STRUTUERE ELEMENTS Once a structure variable has been defined, its member can be accessed through the use of (.) the dot operator. Ex. The code assigns 1740 t the year element of birth_date structure variable declared earlier: birth_date.year = 1740; the structure variable followed by the (.) & name references to that individual structure element.
  • 10. REFRERENCING STRUTUERE ELEMENTS The structure members are just treated like other variables. Therefore to print year of birth_date we can write cout<<birth_date.year;
  • 11. Initializing Structure Elements Structure can be initialized separately or jointly . Member of structure senior_student can be initialized as separately: senior_student.rolln=01; senior_student.class=12; senior_student.marks=50; senior_student.grade=A
  • 12. Initializing Structure Elements Or jointly as: Stutype senior_student = { 01 ,12 ,50 ,A }; Joint structure can not be used befour the variables are defined.
  • 13. Structure Assignment Objects of the same structure can be assign or passed as a function . Ex. The members of senior_student can be assign to junior_student.
  • 14. Structure Assignment Two structure types are different ven they have same members. Struct one { int a ; }; Struct two{int a; }; one s1 ; two s2; cin >> s1.a; //read s1 s2=s1 //error :type mismatch The code will produce an error because both are of different type.
  • 15. NESTED STRUCTURE A structure element may be either complex or simple .the simple elements are int, char, float double . Element of structure may contain structure in itself known as complex structure.
  • 16. ACCESSING NESTED STRUCTURE MEMBER The member of structure can be accessed by using dot operator . To access the city member of address which is the element of other structure worker, we shall write: Worker.address.city
  • 17. STRUCTURE AND ARRAYS Structure and arrays are both derived types. Arrays are the collection of analogous elements, structures assemble dissimilar elements under one roof. Both can be combined to form compels data objects.
  • 18. ARRAYS OF STRUCTURE An array can contain similar elements,the combination having structures within an array is an array of structure .To declare an structure tou must define a structure and then declare an array variable of that type. To declare a 100 element array of structure of type addr men_addr [100] ; To access a specific structure ex . to print houseno of structure 8 write cout << mem_add [7].houseno ;
  • 19. Passing structure to function Passing a local structure to a function can be done in two ways: 1.By passing individual structure element 2. By passing the entire structure.
  • 20. Passing structure elements to function When an element of structure is passed to a function, actually a value of that element to that function is passing . It is just like passing the simple variable. Passing entire structure makes sense when structure is relatively compact. The entire function can be passed by value or by reference.
  • 21. Returning structure from function Just like other types , function can return structure also. Then the type of the function is the same as that of structure returned.
  • 22. User defined data type ‱ C++ allows you to define new type of data types name by using keyword typedef ‱ Typedef does not create new data class rather it define new name for an existing type. ‱ Ex typedef float amount
  • 23. #Define Pre-Processor Directive Pre-processor commands are called DIRECTIVES and begins with a pound symbol.(#). Many things that can be done during pre-processor phase include: Inclusion of other files through #include directive. Definition of symbolic constants and macros through #define directive.
  • 24. #Define Pre-Processor Directive ‱ The preprocessing phase of a c++ program occurs befour a program is compiled . The c++ peprocessor is a program that is executed befour the source code is compiled.
  • 25. #Define Pre-Processor Directive ‱ The preprocessor allows us to define symbolic names and constants. Ex . ‱ 1. #define I 3.14159 ‱ 2.#define MAX 70 Macros are built on #define preprocessor A micro define would be #define SQUARE (x) x*x
  • 26. #Define Pre-Processor Directive The difference is of constant and expression. #include <iostream.h> #define square (x) x*x Void main() {int value=3; cout << square (value); } After preprocessing the code would become Void main() {int value =3; Cout <<value*value}
  • 27. #Define Pre-Processor Directive A few things that must be known about macros A macro without argument is treated like symbolic constant. A micro substitutes text only ; it does not check for data type. While defining macros ,make sure you use parenthesis. #define CIRLE_AREA(X) PI*X*X area =CIRLE_AREA(C+2); IT WOULD BE EXPANDED AS area =3.14159*C+2*C+2;