Submit Search
Upload
Codes on structures
•
0 likes
•
421 views
Shakila Mahjabin
Follow
Practice codes for CSC- 391, Data structure and algorithm.
Read less
Read more
Education
Business
Report
Share
Report
Share
1 of 3
Download now
Download to read offline
Recommended
Module nco rtl
Module nco rtl
Venkat Malai Avichi
JavaScript Gotchas
JavaScript Gotchas
Robert MacLean
Clojure functions 3
Clojure functions 3
Jackson dos Santos Olveira
3分くらいで分かるassert()
3分くらいで分かるassert()
Ippei Ogiwara
cpanfileがRubyでパースできることに気づいた俺たちは
cpanfileがRubyでパースできることに気づいた俺たちは
Takafumi ONAKA
04 2 오버플로 상수 매크로
04 2 오버플로 상수 매크로
Changwon National University
Performance Optimization In Angular 2
Performance Optimization In Angular 2
Eyal Vardi
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
Darwin Durand
Recommended
Module nco rtl
Module nco rtl
Venkat Malai Avichi
JavaScript Gotchas
JavaScript Gotchas
Robert MacLean
Clojure functions 3
Clojure functions 3
Jackson dos Santos Olveira
3分くらいで分かるassert()
3分くらいで分かるassert()
Ippei Ogiwara
cpanfileがRubyでパースできることに気づいた俺たちは
cpanfileがRubyでパースできることに気づいた俺たちは
Takafumi ONAKA
04 2 오버플로 상수 매크로
04 2 오버플로 상수 매크로
Changwon National University
Performance Optimization In Angular 2
Performance Optimization In Angular 2
Eyal Vardi
VISUALIZAR REGISTROS EN UN JTABLE
VISUALIZAR REGISTROS EN UN JTABLE
Darwin Durand
Tugas praktikukm pemrograman c++
Tugas praktikukm pemrograman c++
Dendi Riadi
C++ L07-Struct
C++ L07-Struct
Mohammad Shaker
CSNB244 Lab5
CSNB244 Lab5
Muhd Mu'izuddin
Complete DB code following the instructions Implement the D.pdf
Complete DB code following the instructions Implement the D.pdf
access2future1
C programs
C programs
Azaj Khan
Students Management System c++ project.pptx
Students Management System c++ project.pptx
qaswarsarfraz
Part APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docx
dewhirstichabod
C++ practical
C++ practical
Rahul juneja
12. stl örnekler
12. stl örnekler
karmuhtam
Start with the inclusion of libraries#include iostream .docx
Start with the inclusion of libraries#include iostream .docx
MARRY7
include ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdf
contact32
Rabia
Rabia
university of Gujrat, pakistan
Static and const members
Static and const members
mohamed sikander
Assignment7.pdf
Assignment7.pdf
dash41
CCE management system
CCE management system
Trish004
Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)
Syed Umair
Es6 hackathon
Es6 hackathon
Justin Alexander
Project in programming
Project in programming
sahashi11342091
Algoritma 5 november wiwik p.l
Algoritma 5 november wiwik p.l
Wiwik Puji Lestarii
Programming - Marla Fuentes
Programming - Marla Fuentes
mfuentessss
Computer processing
Computer processing
Shakila Mahjabin
Arrays in CPP
Arrays in CPP
Shakila Mahjabin
More Related Content
Similar to Codes on structures
Tugas praktikukm pemrograman c++
Tugas praktikukm pemrograman c++
Dendi Riadi
C++ L07-Struct
C++ L07-Struct
Mohammad Shaker
CSNB244 Lab5
CSNB244 Lab5
Muhd Mu'izuddin
Complete DB code following the instructions Implement the D.pdf
Complete DB code following the instructions Implement the D.pdf
access2future1
C programs
C programs
Azaj Khan
Students Management System c++ project.pptx
Students Management System c++ project.pptx
qaswarsarfraz
Part APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docx
dewhirstichabod
C++ practical
C++ practical
Rahul juneja
12. stl örnekler
12. stl örnekler
karmuhtam
Start with the inclusion of libraries#include iostream .docx
Start with the inclusion of libraries#include iostream .docx
MARRY7
include ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdf
contact32
Rabia
Rabia
university of Gujrat, pakistan
Static and const members
Static and const members
mohamed sikander
Assignment7.pdf
Assignment7.pdf
dash41
CCE management system
CCE management system
Trish004
Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)
Syed Umair
Es6 hackathon
Es6 hackathon
Justin Alexander
Project in programming
Project in programming
sahashi11342091
Algoritma 5 november wiwik p.l
Algoritma 5 november wiwik p.l
Wiwik Puji Lestarii
Programming - Marla Fuentes
Programming - Marla Fuentes
mfuentessss
Similar to Codes on structures
(20)
Tugas praktikukm pemrograman c++
Tugas praktikukm pemrograman c++
C++ L07-Struct
C++ L07-Struct
CSNB244 Lab5
CSNB244 Lab5
Complete DB code following the instructions Implement the D.pdf
Complete DB code following the instructions Implement the D.pdf
C programs
C programs
Students Management System c++ project.pptx
Students Management System c++ project.pptx
Part APurposeThis laboratory provides some experience work.docx
Part APurposeThis laboratory provides some experience work.docx
C++ practical
C++ practical
12. stl örnekler
12. stl örnekler
Start with the inclusion of libraries#include iostream .docx
Start with the inclusion of libraries#include iostream .docx
include ltiostreamgt include ltstringgt include .pdf
include ltiostreamgt include ltstringgt include .pdf
Rabia
Rabia
Static and const members
Static and const members
Assignment7.pdf
Assignment7.pdf
CCE management system
CCE management system
Assignement of programming & problem solving u.s ass.(1)
Assignement of programming & problem solving u.s ass.(1)
Es6 hackathon
Es6 hackathon
Project in programming
Project in programming
Algoritma 5 november wiwik p.l
Algoritma 5 november wiwik p.l
Programming - Marla Fuentes
Programming - Marla Fuentes
More from Shakila Mahjabin
Computer processing
Computer processing
Shakila Mahjabin
Arrays in CPP
Arrays in CPP
Shakila Mahjabin
CSC 433 Sample normalization SQL Question
CSC 433 Sample normalization SQL Question
Shakila Mahjabin
SQL : introduction
SQL : introduction
Shakila Mahjabin
Normalization
Normalization
Shakila Mahjabin
Solution of Erds
Solution of Erds
Shakila Mahjabin
Entity Relationship Diagram
Entity Relationship Diagram
Shakila Mahjabin
Ch1- Introduction to dbms
Ch1- Introduction to dbms
Shakila Mahjabin
Stack and queue
Stack and queue
Shakila Mahjabin
Algo analysis
Algo analysis
Shakila Mahjabin
Merge sort and quick sort
Merge sort and quick sort
Shakila Mahjabin
Arrays
Arrays
Shakila Mahjabin
array, function, pointer, pattern matching
array, function, pointer, pattern matching
Shakila Mahjabin
String operation
String operation
Shakila Mahjabin
Data Structure Basics
Data Structure Basics
Shakila Mahjabin
More from Shakila Mahjabin
(15)
Computer processing
Computer processing
Arrays in CPP
Arrays in CPP
CSC 433 Sample normalization SQL Question
CSC 433 Sample normalization SQL Question
SQL : introduction
SQL : introduction
Normalization
Normalization
Solution of Erds
Solution of Erds
Entity Relationship Diagram
Entity Relationship Diagram
Ch1- Introduction to dbms
Ch1- Introduction to dbms
Stack and queue
Stack and queue
Algo analysis
Algo analysis
Merge sort and quick sort
Merge sort and quick sort
Arrays
Arrays
array, function, pointer, pattern matching
array, function, pointer, pattern matching
String operation
String operation
Data Structure Basics
Data Structure Basics
Recently uploaded
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
National Information Standards Organization (NISO)
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
Disha Kariya
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
fonyou31
microwave assisted reaction. General introduction
microwave assisted reaction. General introduction
Maksud Ahmed
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
pragatimahajan3
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
JemimahLaneBuaron
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
dawncurless
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
PECB
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
Thiyagu K
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
sanyamsingh5019
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
Dr. Mazin Mohamed alkathiri
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
TechSoup
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
Shobhayan Kirtania
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
FatimaKhan178732
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
National Information Standards Organization (NISO)
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
Association for Project Management
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
iammrhaywood
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
Celine George
Recently uploaded
(20)
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
microwave assisted reaction. General introduction
microwave assisted reaction. General introduction
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
Codes on structures
1.
1. #include <iostream.h> #include <conio.h> #include
<iomanip.h> struct student { int ID; // 4 bytes char name[10];//10bytes float grade; // 4bytes int age; // 4 char phone[10]; // 10 char e_mail[16]; // 16 }; void display(struct student s) { cout<<setw(3)<< s.ID <<setw(12)<< s.name <<setw(8)<< setiosflags (ios::showpoint)<<setprecision(2)<< s.grade<<setw(5)<<s.age <<setw(10)<< s.phone<< setw(18)<<s.e_mail<<endl; } void main() { struct student s1={55,"Amir Ali",3.5f,23,"6535418","amir@yahoo.com"}; struct student s2={26,"Mujahid",2.9888f,25,"5362169", "muj@hotmail.com"}; struct student s3={39,"M Jamil",3.108f,30,"2345677","jam@hotmail.com"}; struct student s4={44,"Dilawar",2.7866f,31,"5432186","dil@hotmail.com"}; struct student s5={59,"S.Naveed",2.9f,27,"2345671","navee@yahoo.com"}; cout<<" Students Records Sheetn"; cout<<" ~~~~~~~~~~~~~~~~~~~~~~nn"; cout<<"ID# NAME GRADE AGE PHONE E-MAILn"; cout<<"~~~ ~~~~ ~~~~~ ~~~ ~~~~~ ~~~~~~~n"; display(s1); // structure pass to function display(s2); // structure pass to function display(s3); display(s4); display(s5); } 2. // In this program you will see the structures (members Manipulation), // Passing structures to functions: #include <iostream.h> #include <iomanip.h> struct S_Details { char name [30];
2.
int exam1; int exam2; int
exam3; int final; float sem_ave; char letter_grade; }; //inputs the data items for a student, structure //is passed by reference struct S_Details get_stu ( ) { struct STU_GRADES student; cout << "nnnn Enter the information for a studentn"; cout << " Name: "; cin.getline (student.name, 30, 'n'); cout << " Exam1: "; cin >> student.exam1; cout << " Exam2: "; cin >> student.exam2; cout << "exam3: "; cin >> student.exam3; cout << "final: "; cin >> student.final; return student; } //displays a student's info. //structure is passed by value void print_stu (struct STU_GRADES stu) { cout << "nnnGrade report for: " << stu.name<<endl; cout << "nexam 1texam 2texam 3tfinaln"; cout << stu.exam1 << "t" << stu.exam2 << "t"<< stu.exam3 << "t" << stu.final; cout << "nnnsemester average: " << setiosflags (ios::fixed)<< setprecision (2) << stu.sem_ave; cout << "nsemester grade: " << stu.letter_grade; } float calc_ave (int ex1, int ex2, int ex3, int final) { float ave; ave = float (ex1 + ex2 + ex3 + final)/4.0f; return ave; } char assign_let (float average) {
3.
char let_grade; if (average
>=90) let_grade = 'A'; else if (average >= 80) let_grade = 'B'; else if (average >= 70) let_grade = 'C'; else if (average >= 60) let_grade = 'D'; else let_grade = 'F'; return let_grade; } int main() { struct S_Details stu; char more; do { //pass the entire structure Stu = get_stu ( ); //pass elements of the strucutre stu.sem_ave = calc_ave (stu.exam1, stu.exam2, stu.exam3, stu.final); //pass elements of the structure stu.letter_grade = assign_let (stu.sem_ave); //pass the entire structure print_stu (stu); cout << "nnn Enter another student? (y/n) "; cin >> more; //grab the carriage return since //character data is input next cin.ignore ( ); } while (more == 'y' || more == 'Y'); return 0; }
Download now