SlideShare a Scribd company logo
 
Arrays can be used to represent a group of data items that belong to the same type, such as  int  or  float  . If we want to represent a collection of data items of different types using a single name then we cannot use an array.  The data type which we use is known as  structure.  Structure  is user defined data type.
struct  struct_name { data_type member1; data_type member2; …  … };
//header  files #include<stdio.h> #include<conio.h> //Structure declaration struct student { // data types & members  int rollno; char name[20]; };
void main () { struct student  S1; // Structure variable  printf( “Input the name of student “ ); scanf( “%d” ,&S1.name); printf( “Input the Roll number of student “ ); scanf( “%d” ,&S1.rollno); printf( “name =%d“ S1.name); printf( “Roll number=%d“ S1.rollno); getch(); }
Input the name of student  abc Input the Roll number of student  1 name = abc Roll number = 1
rollno name 10 11 12 13 14 15 16 17 18 19 0 1 2 3 4 5 6 7 8 9 20 21
Unions are a concept borrowed from structures and therefore follow the same syntax as structures . There is a major difference between them in terms of storage . A union may contain many members of different types ,it can handle only one member at a time.
union union_name {  data_type member1; data_type member2; …  … };
//header  files #include<stdio.h> #include<conio.h> //Union declaration union student { // data types & members  int rollno; char name[20]; };
void main () { union student  S1; // Union variable  printf( “Input the name of student “ ); scanf( “%d” ,&S1.name); printf( “Input the Roll number of student “ ); scanf( “%d” ,&S1.rollno); printf( “name =%d“ S1.name); printf( “Roll number=%d“ S1.rollno); getch(); }
Input the name of student  abc Input the Roll number of student  1 name = abc Roll number = 1
name rollno 10 11 12 13 14 15 16 17 18 19 0 1 2 3 4 5 6 7 8 9
Classes are same as structure but with a small difference  ie. Structure are having data only(int or float) but classes are having data and functions together. The class has a mechanism to prevent direct access to its members ,which is the central idea of object-oriented programming. Classes are user defined data types. In short structure + functions = classes.
A class definition begin with the keyword  class. The body of the class is contained with in the brace { }; Class Data  Functions
class  <name of class> { private: declaration of variables ; declaration of functions ; public: declaration of variables ; declaration of functions; };
// Header files #include<iostream.h> #include<conio.h> class  student  // class declaration { private: int rollno;  //  data members  char name[20]; public: void getdata();  // functions
// defining member function inside the class definition   void display() { cout<< “Name=“ <<name<<endl; cout<< “Roll number=“ <<rollno<<endl; } };
//  defining member functions outside the class definition void student :: getdata() { cout<< “Input the name of student” ; cin>>name; cout<< “Input the roll number” ; cin>>rollno; }
main() { cout<< “We are in main function “ ; student S1;  // creat object S1 S1.getdata();  // call member function S1.display();  // call member function getch(); }
Input the name of student abc Input the roll number 1 Name = abc  Roll number = 1
 
 
Ad

More Related Content

What's hot (19)

Friend function & friend class
Friend function & friend classFriend function & friend class
Friend function & friend class
Abhishek Wadhwa
 
Pointers & functions
Pointers &  functionsPointers &  functions
Pointers & functions
Manjitsing Valvi
 
Object Oriented Programming_Lecture 2
Object Oriented Programming_Lecture 2Object Oriented Programming_Lecture 2
Object Oriented Programming_Lecture 2
Mahmoud Alfarra
 
Effective PHP. Part 2
Effective PHP. Part 2Effective PHP. Part 2
Effective PHP. Part 2
Vasily Kartashov
 
Effective PHP. Part 4
Effective PHP. Part 4Effective PHP. Part 4
Effective PHP. Part 4
Vasily Kartashov
 
Computer data type and Terminologies
Computer data type and Terminologies Computer data type and Terminologies
Computer data type and Terminologies
glyvive
 
Object as function argument , friend and static function by shahzad younas
Object as function argument , friend and static function by shahzad younasObject as function argument , friend and static function by shahzad younas
Object as function argument , friend and static function by shahzad younas
Shahzad Younas
 
Iktomi forms
Iktomi formsIktomi forms
Iktomi forms
Harut Dagesian
 
Composite types
Composite typesComposite types
Composite types
Manjitsing Valvi
 
Database design and error handling
Database design and error handlingDatabase design and error handling
Database design and error handling
hamsa nandhini
 
Scala laboratory: Globus. iteration #2
Scala laboratory: Globus. iteration #2Scala laboratory: Globus. iteration #2
Scala laboratory: Globus. iteration #2
Vasil Remeniuk
 
Unsafe to typesafe
Unsafe to typesafeUnsafe to typesafe
Unsafe to typesafe
regisleray
 
Effective PHP. Part 6
Effective PHP. Part 6Effective PHP. Part 6
Effective PHP. Part 6
Vasily Kartashov
 
What is Non-primitive data type?
What is Non-primitive data type?What is Non-primitive data type?
What is Non-primitive data type?
AnuragSrivastava272
 
البرمجة الهدفية بلغة جافا - تعدد الأشكال
البرمجة الهدفية بلغة جافا - تعدد الأشكالالبرمجة الهدفية بلغة جافا - تعدد الأشكال
البرمجة الهدفية بلغة جافا - تعدد الأشكال
Mahmoud Alfarra
 
البرمجة الهدفية بلغة جافا - مفاهيم أساسية
البرمجة الهدفية بلغة جافا - مفاهيم أساسية البرمجة الهدفية بلغة جافا - مفاهيم أساسية
البرمجة الهدفية بلغة جافا - مفاهيم أساسية
Mahmoud Alfarra
 
Structure for cpu
Structure for cpuStructure for cpu
Structure for cpu
jay patel
 
MuleSoft DataWeave data transformation language
MuleSoft DataWeave data transformation languageMuleSoft DataWeave data transformation language
MuleSoft DataWeave data transformation language
fganora
 
Variables and datatypes in javascript
Variables and datatypes in javascriptVariables and datatypes in javascript
Variables and datatypes in javascript
Vivek Kumar
 
Friend function & friend class
Friend function & friend classFriend function & friend class
Friend function & friend class
Abhishek Wadhwa
 
Object Oriented Programming_Lecture 2
Object Oriented Programming_Lecture 2Object Oriented Programming_Lecture 2
Object Oriented Programming_Lecture 2
Mahmoud Alfarra
 
Computer data type and Terminologies
Computer data type and Terminologies Computer data type and Terminologies
Computer data type and Terminologies
glyvive
 
Object as function argument , friend and static function by shahzad younas
Object as function argument , friend and static function by shahzad younasObject as function argument , friend and static function by shahzad younas
Object as function argument , friend and static function by shahzad younas
Shahzad Younas
 
Database design and error handling
Database design and error handlingDatabase design and error handling
Database design and error handling
hamsa nandhini
 
Scala laboratory: Globus. iteration #2
Scala laboratory: Globus. iteration #2Scala laboratory: Globus. iteration #2
Scala laboratory: Globus. iteration #2
Vasil Remeniuk
 
Unsafe to typesafe
Unsafe to typesafeUnsafe to typesafe
Unsafe to typesafe
regisleray
 
What is Non-primitive data type?
What is Non-primitive data type?What is Non-primitive data type?
What is Non-primitive data type?
AnuragSrivastava272
 
البرمجة الهدفية بلغة جافا - تعدد الأشكال
البرمجة الهدفية بلغة جافا - تعدد الأشكالالبرمجة الهدفية بلغة جافا - تعدد الأشكال
البرمجة الهدفية بلغة جافا - تعدد الأشكال
Mahmoud Alfarra
 
البرمجة الهدفية بلغة جافا - مفاهيم أساسية
البرمجة الهدفية بلغة جافا - مفاهيم أساسية البرمجة الهدفية بلغة جافا - مفاهيم أساسية
البرمجة الهدفية بلغة جافا - مفاهيم أساسية
Mahmoud Alfarra
 
Structure for cpu
Structure for cpuStructure for cpu
Structure for cpu
jay patel
 
MuleSoft DataWeave data transformation language
MuleSoft DataWeave data transformation languageMuleSoft DataWeave data transformation language
MuleSoft DataWeave data transformation language
fganora
 
Variables and datatypes in javascript
Variables and datatypes in javascriptVariables and datatypes in javascript
Variables and datatypes in javascript
Vivek Kumar
 

Similar to Presentation on structure,functions and classes (20)

Structures
StructuresStructures
Structures
DrJasmineBeulahG
 
Easy Understanding of Structure Union Typedef Enum in C Language.pdf
Easy Understanding of Structure Union Typedef Enum in C Language.pdfEasy Understanding of Structure Union Typedef Enum in C Language.pdf
Easy Understanding of Structure Union Typedef Enum in C Language.pdf
sudhakargeruganti
 
detail structure presentation of problem solving
detail structure presentation of problem solvingdetail structure presentation of problem solving
detail structure presentation of problem solving
talencorconsultancy
 
VIT351 Software Development VI Unit4
VIT351 Software Development VI Unit4VIT351 Software Development VI Unit4
VIT351 Software Development VI Unit4
YOGESH SINGH
 
Programming for problem solving-II(UNIT-2).pptx
Programming for problem solving-II(UNIT-2).pptxProgramming for problem solving-II(UNIT-2).pptx
Programming for problem solving-II(UNIT-2).pptx
prathima304
 
C Language_PPS_3110003_unit 8ClassPPT.ppt
C Language_PPS_3110003_unit 8ClassPPT.pptC Language_PPS_3110003_unit 8ClassPPT.ppt
C Language_PPS_3110003_unit 8ClassPPT.ppt
NikeshaPatel1
 
Principals of Programming in CModule -5.pdf
Principals of Programming in CModule -5.pdfPrincipals of Programming in CModule -5.pdf
Principals of Programming in CModule -5.pdf
anilcsbs
 
Lk module4 structures
Lk module4 structuresLk module4 structures
Lk module4 structures
Krishna Nanda
 
Unit4 C
Unit4 C Unit4 C
Unit4 C
arnold 7490
 
PROBLEM SOLVING USING C PPSC- UNIT -5.pdf
PROBLEM SOLVING USING C PPSC- UNIT -5.pdfPROBLEM SOLVING USING C PPSC- UNIT -5.pdf
PROBLEM SOLVING USING C PPSC- UNIT -5.pdf
JNTUK KAKINADA
 
Unit 5 (1)
Unit 5 (1)Unit 5 (1)
Unit 5 (1)
psaravanan1985
 
STRUCTURES IN C PROGRAMMING
STRUCTURES IN C PROGRAMMING STRUCTURES IN C PROGRAMMING
STRUCTURES IN C PROGRAMMING
Gurwinderkaur45
 
Classes, objects and methods
Classes, objects and methodsClasses, objects and methods
Classes, objects and methods
farhan amjad
 
structure1.pdf
structure1.pdfstructure1.pdf
structure1.pdf
AbhimanyuKumarYadav3
 
programming in C and Datastructures deepdive
programming in C and Datastructures deepdiveprogramming in C and Datastructures deepdive
programming in C and Datastructures deepdive
Sangeetha Prakash
 
programming in C & Data structures an easy approach
programming in C & Data structures an easy  approachprogramming in C & Data structures an easy  approach
programming in C & Data structures an easy approach
Sangeetha Prakash
 
data structure and c programing concepts
data structure and c programing conceptsdata structure and c programing concepts
data structure and c programing concepts
kavitham66441
 
Address, Pointers, Arrays, and Structures2.pptx
Address, Pointers, Arrays, and Structures2.pptxAddress, Pointers, Arrays, and Structures2.pptx
Address, Pointers, Arrays, and Structures2.pptx
Dr. Amna Mohamed
 
Structure In C
Structure In CStructure In C
Structure In C
yndaravind
 
structure.ppt
structure.pptstructure.ppt
structure.ppt
Sheik Mohideen
 
Easy Understanding of Structure Union Typedef Enum in C Language.pdf
Easy Understanding of Structure Union Typedef Enum in C Language.pdfEasy Understanding of Structure Union Typedef Enum in C Language.pdf
Easy Understanding of Structure Union Typedef Enum in C Language.pdf
sudhakargeruganti
 
detail structure presentation of problem solving
detail structure presentation of problem solvingdetail structure presentation of problem solving
detail structure presentation of problem solving
talencorconsultancy
 
VIT351 Software Development VI Unit4
VIT351 Software Development VI Unit4VIT351 Software Development VI Unit4
VIT351 Software Development VI Unit4
YOGESH SINGH
 
Programming for problem solving-II(UNIT-2).pptx
Programming for problem solving-II(UNIT-2).pptxProgramming for problem solving-II(UNIT-2).pptx
Programming for problem solving-II(UNIT-2).pptx
prathima304
 
C Language_PPS_3110003_unit 8ClassPPT.ppt
C Language_PPS_3110003_unit 8ClassPPT.pptC Language_PPS_3110003_unit 8ClassPPT.ppt
C Language_PPS_3110003_unit 8ClassPPT.ppt
NikeshaPatel1
 
Principals of Programming in CModule -5.pdf
Principals of Programming in CModule -5.pdfPrincipals of Programming in CModule -5.pdf
Principals of Programming in CModule -5.pdf
anilcsbs
 
Lk module4 structures
Lk module4 structuresLk module4 structures
Lk module4 structures
Krishna Nanda
 
PROBLEM SOLVING USING C PPSC- UNIT -5.pdf
PROBLEM SOLVING USING C PPSC- UNIT -5.pdfPROBLEM SOLVING USING C PPSC- UNIT -5.pdf
PROBLEM SOLVING USING C PPSC- UNIT -5.pdf
JNTUK KAKINADA
 
STRUCTURES IN C PROGRAMMING
STRUCTURES IN C PROGRAMMING STRUCTURES IN C PROGRAMMING
STRUCTURES IN C PROGRAMMING
Gurwinderkaur45
 
Classes, objects and methods
Classes, objects and methodsClasses, objects and methods
Classes, objects and methods
farhan amjad
 
programming in C and Datastructures deepdive
programming in C and Datastructures deepdiveprogramming in C and Datastructures deepdive
programming in C and Datastructures deepdive
Sangeetha Prakash
 
programming in C & Data structures an easy approach
programming in C & Data structures an easy  approachprogramming in C & Data structures an easy  approach
programming in C & Data structures an easy approach
Sangeetha Prakash
 
data structure and c programing concepts
data structure and c programing conceptsdata structure and c programing concepts
data structure and c programing concepts
kavitham66441
 
Address, Pointers, Arrays, and Structures2.pptx
Address, Pointers, Arrays, and Structures2.pptxAddress, Pointers, Arrays, and Structures2.pptx
Address, Pointers, Arrays, and Structures2.pptx
Dr. Amna Mohamed
 
Structure In C
Structure In CStructure In C
Structure In C
yndaravind
 
Ad

More from Alisha Korpal (20)

Cyber crime and secuity
Cyber crime and secuityCyber crime and secuity
Cyber crime and secuity
Alisha Korpal
 
Ppt on remote sensing system
Ppt on remote sensing systemPpt on remote sensing system
Ppt on remote sensing system
Alisha Korpal
 
Air crew
Air crewAir crew
Air crew
Alisha Korpal
 
Research presentaion on 2g,3g
Research presentaion on 2g,3gResearch presentaion on 2g,3g
Research presentaion on 2g,3g
Alisha Korpal
 
Alisha
AlishaAlisha
Alisha
Alisha Korpal
 
Ppt on remote sensing system
Ppt on remote sensing systemPpt on remote sensing system
Ppt on remote sensing system
Alisha Korpal
 
Computer graphics report
Computer graphics reportComputer graphics report
Computer graphics report
Alisha Korpal
 
Ppt on flat panel display
Ppt on flat panel displayPpt on flat panel display
Ppt on flat panel display
Alisha Korpal
 
Java swings
Java swingsJava swings
Java swings
Alisha Korpal
 
Search engine
Search engineSearch engine
Search engine
Alisha Korpal
 
Report swings
Report swingsReport swings
Report swings
Alisha Korpal
 
Search engine
Search engineSearch engine
Search engine
Alisha Korpal
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligence
Alisha Korpal
 
AiArtificial Itelligence
AiArtificial ItelligenceAiArtificial Itelligence
AiArtificial Itelligence
Alisha Korpal
 
Science and tecnology
Science and tecnologyScience and tecnology
Science and tecnology
Alisha Korpal
 
Visual basic
Visual basicVisual basic
Visual basic
Alisha Korpal
 
Internet
InternetInternet
Internet
Alisha Korpal
 
Report on data link layer
Report on data link layerReport on data link layer
Report on data link layer
Alisha Korpal
 
Presentation on dll
Presentation on dllPresentation on dll
Presentation on dll
Alisha Korpal
 
Report on touch screen
Report on touch screenReport on touch screen
Report on touch screen
Alisha Korpal
 
Ad

Recently uploaded (20)

Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Sugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptxSugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptx
Dr. Renu Jangid
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Understanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s GuideUnderstanding P–N Junction Semiconductors: A Beginner’s Guide
Understanding P–N Junction Semiconductors: A Beginner’s Guide
GS Virdi
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFAExercise Physiology MCQS By DR. NASIR MUSTAFA
Exercise Physiology MCQS By DR. NASIR MUSTAFA
Dr. Nasir Mustafa
 
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx   quiz by Ridip HazarikaTHE STG QUIZ GROUP D.pptx   quiz by Ridip Hazarika
THE STG QUIZ GROUP D.pptx quiz by Ridip Hazarika
Ridip Hazarika
 
How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18How to Manage Purchase Alternatives in Odoo 18
How to Manage Purchase Alternatives in Odoo 18
Celine George
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
To study Digestive system of insect.pptx
To study Digestive system of insect.pptxTo study Digestive system of insect.pptx
To study Digestive system of insect.pptx
Arshad Shaikh
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.03#UNTAGGED. Generosity in architecture.
03#UNTAGGED. Generosity in architecture.
MCH
 
2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx2541William_McCollough_DigitalDetox.docx
2541William_McCollough_DigitalDetox.docx
contactwilliamm2546
 
Sugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptxSugar-Sensing Mechanism in plants....pptx
Sugar-Sensing Mechanism in plants....pptx
Dr. Renu Jangid
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025Stein, Hunt, Green letter to Congress April 2025
Stein, Hunt, Green letter to Congress April 2025
Mebane Rash
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Real GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for SuccessReal GitHub Copilot Exam Dumps for Success
Real GitHub Copilot Exam Dumps for Success
Mark Soia
 

Presentation on structure,functions and classes

  • 1.  
  • 2. Arrays can be used to represent a group of data items that belong to the same type, such as int or float . If we want to represent a collection of data items of different types using a single name then we cannot use an array. The data type which we use is known as structure. Structure is user defined data type.
  • 3. struct struct_name { data_type member1; data_type member2; … … };
  • 4. //header files #include<stdio.h> #include<conio.h> //Structure declaration struct student { // data types & members int rollno; char name[20]; };
  • 5. void main () { struct student S1; // Structure variable printf( “Input the name of student “ ); scanf( “%d” ,&S1.name); printf( “Input the Roll number of student “ ); scanf( “%d” ,&S1.rollno); printf( “name =%d“ S1.name); printf( “Roll number=%d“ S1.rollno); getch(); }
  • 6. Input the name of student abc Input the Roll number of student 1 name = abc Roll number = 1
  • 7. rollno name 10 11 12 13 14 15 16 17 18 19 0 1 2 3 4 5 6 7 8 9 20 21
  • 8. Unions are a concept borrowed from structures and therefore follow the same syntax as structures . There is a major difference between them in terms of storage . A union may contain many members of different types ,it can handle only one member at a time.
  • 9. union union_name { data_type member1; data_type member2; … … };
  • 10. //header files #include<stdio.h> #include<conio.h> //Union declaration union student { // data types & members int rollno; char name[20]; };
  • 11. void main () { union student S1; // Union variable printf( “Input the name of student “ ); scanf( “%d” ,&S1.name); printf( “Input the Roll number of student “ ); scanf( “%d” ,&S1.rollno); printf( “name =%d“ S1.name); printf( “Roll number=%d“ S1.rollno); getch(); }
  • 12. Input the name of student abc Input the Roll number of student 1 name = abc Roll number = 1
  • 13. name rollno 10 11 12 13 14 15 16 17 18 19 0 1 2 3 4 5 6 7 8 9
  • 14. Classes are same as structure but with a small difference ie. Structure are having data only(int or float) but classes are having data and functions together. The class has a mechanism to prevent direct access to its members ,which is the central idea of object-oriented programming. Classes are user defined data types. In short structure + functions = classes.
  • 15. A class definition begin with the keyword class. The body of the class is contained with in the brace { }; Class Data Functions
  • 16. class <name of class> { private: declaration of variables ; declaration of functions ; public: declaration of variables ; declaration of functions; };
  • 17. // Header files #include<iostream.h> #include<conio.h> class student // class declaration { private: int rollno; // data members char name[20]; public: void getdata(); // functions
  • 18. // defining member function inside the class definition void display() { cout<< “Name=“ <<name<<endl; cout<< “Roll number=“ <<rollno<<endl; } };
  • 19. // defining member functions outside the class definition void student :: getdata() { cout<< “Input the name of student” ; cin>>name; cout<< “Input the roll number” ; cin>>rollno; }
  • 20. main() { cout<< “We are in main function “ ; student S1; // creat object S1 S1.getdata(); // call member function S1.display(); // call member function getch(); }
  • 21. Input the name of student abc Input the roll number 1 Name = abc Roll number = 1
  • 22.  
  • 23.