SlideShare a Scribd company logo
Programming & Algorithm Structures August 17, 2006
What Is a Structure? A  structure  is a collection of one or more variables grouped under a single name for easy manipulation. Each variable within a structure is called a  member  of the structure.
Defining and Declaring Structures struct  struct_ name < varname_1 :  vartype_1 varname_2 :   vartype_2   … varname_n :  vartype_n > varname :  struct_name
Defining and Declaring Structures E.g.: Program Example Kamus: struct student: < name : string nrp : integer > M : student Algoritma: M.name ← “Jhony” M.nrp ← 7201001
More-Complex Structures A structure can contain other structures. A structure can contain one or more arrays as members. You can also have an array of structures.
Exercises Create a program that asks for two coordinates (coord1 and coord2}) in integer. Display the linear equation that through the coordinates in y=mx+c form. E.g.: The linear equation that through {1, 2} and {5, 7} is y=1.25x + 0.75. Note:  Use a structure  that hold two type integer member (x, y).
Exercises A structure has one type integer member (NIM) and one type float member (IPK). Create a program using the structure that asks data of five students and displays data of the lowest and the highest IPK on screen. A structured named triangle has three coordinates. Create a program that asks coordinates of a triangle and display the its circumference on screen.

More Related Content

DOCX
Structure in c sharp
PPTX
4 sequential pattern mining
DOCX
Smu mca sem 1 winter 2014 assignments
PPT
L6 structure
PPTX
When to use a structure vs classes in c++
PPTX
Structure in c language
PDF
Refactoring et al
Structure in c sharp
4 sequential pattern mining
Smu mca sem 1 winter 2014 assignments
L6 structure
When to use a structure vs classes in c++
Structure in c language
Refactoring et al

What's hot (20)

PDF
2013 11 CSharp Tutorial Struct and Class
PDF
Structures in c++
PPTX
Mca ii dfs u-1 introduction to data structure
PDF
Lecture18 structurein c.ppt
PDF
Structures
PPTX
Bca ii dfs u-1 introduction to data structure
PPTX
Bsc cs ii dfs u-1 introduction to data structure
PPTX
Structures
PPT
Data structure lecture 1
PPTX
Structure & Union in C++
PDF
Introduction of data structures and algorithms
PDF
R data types
DOCX
Functions reading passage
PDF
C structure and union
PPTX
Data structure & its types
PPTX
Type casting in java
PDF
Python for beginners
PPTX
Structure in C
PPTX
Basic of Structure,Structure members,Accessing Structure member,Nested Struct...
PPT
Structure in c
2013 11 CSharp Tutorial Struct and Class
Structures in c++
Mca ii dfs u-1 introduction to data structure
Lecture18 structurein c.ppt
Structures
Bca ii dfs u-1 introduction to data structure
Bsc cs ii dfs u-1 introduction to data structure
Structures
Data structure lecture 1
Structure & Union in C++
Introduction of data structures and algorithms
R data types
Functions reading passage
C structure and union
Data structure & its types
Type casting in java
Python for beginners
Structure in C
Basic of Structure,Structure members,Accessing Structure member,Nested Struct...
Structure in c
Ad

Similar to Structures [8] (20)

PPTX
Structure prespentation
PDF
unit 5.pdf structure pdf is here you can do this
PPTX
ECE2102-Week13 - 14-Strhhhhhhhjjjucts.pptx
PPTX
Structure.pptx
PPT
Structures and Unions in C-Language with Examples.ppt
PDF
Structure in C Programming- Basic Concepts
PPT
structures_v1.ppt
PPT
structures_v1.ppt
PDF
Structures in c++
PPTX
User defined data types.pptx
PPT
Structure for cpu
PPT
Introduction-to-structures-using-C-programming.ppt
PPTX
STRUCTURES IN C PROGRAMMING
PDF
1. structure
PPTX
12Structures.pptx
PPTX
Data Structures and Algorithms_Updated.pptx
PPTX
Cs1123 12 structures
PPSX
Stuctures in c++ in a sample way PPT
PDF
Chapter 13.1.9
DOCX
Str
Structure prespentation
unit 5.pdf structure pdf is here you can do this
ECE2102-Week13 - 14-Strhhhhhhhjjjucts.pptx
Structure.pptx
Structures and Unions in C-Language with Examples.ppt
Structure in C Programming- Basic Concepts
structures_v1.ppt
structures_v1.ppt
Structures in c++
User defined data types.pptx
Structure for cpu
Introduction-to-structures-using-C-programming.ppt
STRUCTURES IN C PROGRAMMING
1. structure
12Structures.pptx
Data Structures and Algorithms_Updated.pptx
Cs1123 12 structures
Stuctures in c++ in a sample way PPT
Chapter 13.1.9
Str
Ad

More from ecko_disasterz (6)

PPT
Flow Chart & Input Output Statement [3] M
PPT
Numeric Arrays [6]
PPT
Functions & Procedures [7]
PPT
Loop Statements [5] M
PPT
Conditional Statements [4]
PPT
Introduction To Algorithm [2]
Flow Chart & Input Output Statement [3] M
Numeric Arrays [6]
Functions & Procedures [7]
Loop Statements [5] M
Conditional Statements [4]
Introduction To Algorithm [2]

Recently uploaded (20)

PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PPTX
Machine Learning_overview_presentation.pptx
PDF
Encapsulation theory and applications.pdf
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Machine learning based COVID-19 study performance prediction
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
A Presentation on Artificial Intelligence
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Machine Learning_overview_presentation.pptx
Encapsulation theory and applications.pdf
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Unlocking AI with Model Context Protocol (MCP)
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Building Integrated photovoltaic BIPV_UPV.pdf
MYSQL Presentation for SQL database connectivity
Digital-Transformation-Roadmap-for-Companies.pptx
Network Security Unit 5.pdf for BCA BBA.
Advanced methodologies resolving dimensionality complications for autism neur...
Machine learning based COVID-19 study performance prediction
Programs and apps: productivity, graphics, security and other tools
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Spectral efficient network and resource selection model in 5G networks
Dropbox Q2 2025 Financial Results & Investor Presentation
Assigned Numbers - 2025 - Bluetooth® Document
“AI and Expert System Decision Support & Business Intelligence Systems”
A Presentation on Artificial Intelligence

Structures [8]

  • 1. Programming & Algorithm Structures August 17, 2006
  • 2. What Is a Structure? A structure is a collection of one or more variables grouped under a single name for easy manipulation. Each variable within a structure is called a member of the structure.
  • 3. Defining and Declaring Structures struct struct_ name < varname_1 : vartype_1 varname_2 : vartype_2 … varname_n : vartype_n > varname : struct_name
  • 4. Defining and Declaring Structures E.g.: Program Example Kamus: struct student: < name : string nrp : integer > M : student Algoritma: M.name ← “Jhony” M.nrp ← 7201001
  • 5. More-Complex Structures A structure can contain other structures. A structure can contain one or more arrays as members. You can also have an array of structures.
  • 6. Exercises Create a program that asks for two coordinates (coord1 and coord2}) in integer. Display the linear equation that through the coordinates in y=mx+c form. E.g.: The linear equation that through {1, 2} and {5, 7} is y=1.25x + 0.75. Note: Use a structure that hold two type integer member (x, y).
  • 7. Exercises A structure has one type integer member (NIM) and one type float member (IPK). Create a program using the structure that asks data of five students and displays data of the lowest and the highest IPK on screen. A structured named triangle has three coordinates. Create a program that asks coordinates of a triangle and display the its circumference on screen.