SlideShare une entreprise Scribd logo
1  sur  11
EXTRA
EXTRA 
++
++ NOTES
NOTES 
++
#include<iostream.h> 
#include<conio.h> 
struct student 
{ 
char name[20]; 
int marks; 
float per; 
}; 
void main() 
{ 
struct student stu; 
clrscr(); 
cout<<“Enter Student Namen”; 
gets(stu.name); 
cout<<“Enter Student Marksn”; 
cin>>stu.marks; 
cout<<“Enter Percentagen”; 
cin>>stu.per; 
cout<<“NAME :”; 
puts(stu.name); 
cout<<“MARKS :”<<stu.marks<<“n”; 
cout<<“PERCENTAGE :”<<stu.per<<“n”; 
getch(); 
} 
EXTRA
#include<iostream.h> Structure within structure 
#include<conio.h> 
struct address 
{ 
char street[10]; 
char city[10]; 
char state[10]; 
}; 
struct employee 
{ 
char name[20]; 
char des[10]; 
struct address add; 
int salary; 
}; 
void main() 
{ 
struct employee emp; 
clrscr(); 
cout<<"Enter Employee detailsn”; 
cout<<"Enter Namen"; 
gets(emp.name); 
EXTRA
cout<<"Enter Designationn”; 
gets(emp.des); 
cout<<"Enter Addressn"; 
cout<<"Enter street n”; 
gets(emp.add.street); 
cout<<"Enter Cityn"; 
gets(emp.add.city); 
cout<<"Enter Staten"; 
gets(emp.add.state); 
cout<<"Enter Slalryn”; 
cin>>emp.salary; 
cout<<"EMPLOYEE DETAILSn”; 
cout<<"NAME :”; 
puts(emp.name); 
cout<<"DESIGNATION :”; 
puts(emp.des); 
cout<<"ADDRESS :n”; 
cout<<"STREET :”; 
puts(emp.add.street); 
cout<<"CITY :”; 
puts(emp.add.city); 
cout<<"STATE :"; 
puts(emp.add.state); 
cout<<"SALARY :”<<emp.salary<<“n” ; 
getch(); 
} 
EXTRA
EXTRA 
++
NOTES 
++
#include<stdio.h> 
#include<conio.h> 
union marks 
{ int phy; 
int che; 
int mat; 
int total; 
float per; 
}s1; 
void main() 
{ 
clrscr(); 
cout<<“Enter Marks detailsn”; 
cout<<"Enter physics marksn”; 
cin>>s1.phy; 
cout<<"Enter chemistry marksn”; 
cin>>s1.che; 
cout<<"Enter Math Marksn”; 
cin>>s1.mat; 
s1.total=s1.phy+s1.che+s1.mat; 
cout<<"Total Marks = “<<s1.total <<“n”; 
s1.per=s1.total*1/3; 
cout<<"Percentage = ”<<s1.pern”; 
getch(); 
} 
EXTRA

Contenu connexe

Tendances

Hidden Gems in Swift
Hidden Gems in SwiftHidden Gems in Swift
Hidden Gems in SwiftNetguru
 
STRUCTURES IN C PROGRAMMING
STRUCTURES IN C PROGRAMMING STRUCTURES IN C PROGRAMMING
STRUCTURES IN C PROGRAMMING Gurwinderkaur45
 
Type safe embedded domain-specific languages
Type safe embedded domain-specific languagesType safe embedded domain-specific languages
Type safe embedded domain-specific languagesArthur Xavier
 
Pf cs102 programming-10 [structs]
Pf cs102 programming-10 [structs]Pf cs102 programming-10 [structs]
Pf cs102 programming-10 [structs]Abdullah khawar
 
Basic Object Oriented Concepts
Basic Object Oriented ConceptsBasic Object Oriented Concepts
Basic Object Oriented ConceptsScott Lee
 
Variables, expressions, standard types
 Variables, expressions, standard types  Variables, expressions, standard types
Variables, expressions, standard types Rubizza
 
Java script introducation & basics
Java script introducation & basicsJava script introducation & basics
Java script introducation & basicsH K
 
重構—改善既有程式的設計(chapter 9)
重構—改善既有程式的設計(chapter 9)重構—改善既有程式的設計(chapter 9)
重構—改善既有程式的設計(chapter 9)Chris Huang
 
JavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashJavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashBret Little
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiMuhammed Thanveer M
 
2013 11 CSharp Tutorial Struct and Class
2013 11 CSharp Tutorial Struct and Class2013 11 CSharp Tutorial Struct and Class
2013 11 CSharp Tutorial Struct and ClassHung-Wei Liu
 

Tendances (20)

Hidden Gems in Swift
Hidden Gems in SwiftHidden Gems in Swift
Hidden Gems in Swift
 
Arrays
ArraysArrays
Arrays
 
Unit 5 (1)
Unit 5 (1)Unit 5 (1)
Unit 5 (1)
 
Structures
StructuresStructures
Structures
 
STRUCTURES IN C PROGRAMMING
STRUCTURES IN C PROGRAMMING STRUCTURES IN C PROGRAMMING
STRUCTURES IN C PROGRAMMING
 
Type safe embedded domain-specific languages
Type safe embedded domain-specific languagesType safe embedded domain-specific languages
Type safe embedded domain-specific languages
 
Pf cs102 programming-10 [structs]
Pf cs102 programming-10 [structs]Pf cs102 programming-10 [structs]
Pf cs102 programming-10 [structs]
 
Basic Object Oriented Concepts
Basic Object Oriented ConceptsBasic Object Oriented Concepts
Basic Object Oriented Concepts
 
Variables, expressions, standard types
 Variables, expressions, standard types  Variables, expressions, standard types
Variables, expressions, standard types
 
Structures
StructuresStructures
Structures
 
Java script introducation & basics
Java script introducation & basicsJava script introducation & basics
Java script introducation & basics
 
C# 7.0, 7.1, 7.2
C# 7.0, 7.1, 7.2C# 7.0, 7.1, 7.2
C# 7.0, 7.1, 7.2
 
Python lecture 05
Python lecture 05Python lecture 05
Python lecture 05
 
重構—改善既有程式的設計(chapter 9)
重構—改善既有程式的設計(chapter 9)重構—改善既有程式的設計(chapter 9)
重構—改善既有程式的設計(chapter 9)
 
Constructors
ConstructorsConstructors
Constructors
 
Structures
StructuresStructures
Structures
 
Pointers
PointersPointers
Pointers
 
JavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and LodashJavaScript Fundamentals with Angular and Lodash
JavaScript Fundamentals with Angular and Lodash
 
Oop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer MelayiOop concept in c++ by MUhammed Thanveer Melayi
Oop concept in c++ by MUhammed Thanveer Melayi
 
2013 11 CSharp Tutorial Struct and Class
2013 11 CSharp Tutorial Struct and Class2013 11 CSharp Tutorial Struct and Class
2013 11 CSharp Tutorial Struct and Class
 

En vedette

Application software
Application softwareApplication software
Application softwareargusacademy
 
VISUAL BASIC .net iii
VISUAL BASIC .net iiiVISUAL BASIC .net iii
VISUAL BASIC .net iiiargusacademy
 
VISUAL BASIC .net vi
VISUAL BASIC .net viVISUAL BASIC .net vi
VISUAL BASIC .net viargusacademy
 
TALLY Service tax & tds ENTRY
TALLY Service tax & tds ENTRYTALLY Service tax & tds ENTRY
TALLY Service tax & tds ENTRYargusacademy
 
TALLY 1 st level entry
TALLY 1 st level entryTALLY 1 st level entry
TALLY 1 st level entryargusacademy
 
VISUAL BASIC .net iv
VISUAL BASIC .net ivVISUAL BASIC .net iv
VISUAL BASIC .net ivargusacademy
 
Computer development
Computer developmentComputer development
Computer developmentargusacademy
 
VISUAL BASIC .net ii
VISUAL BASIC .net iiVISUAL BASIC .net ii
VISUAL BASIC .net iiargusacademy
 
C programming file handling
C  programming file handlingC  programming file handling
C programming file handlingargusacademy
 
C programming flow of controls
C  programming flow of controlsC  programming flow of controls
C programming flow of controlsargusacademy
 
TALLY Payroll ENTRY
TALLY Payroll ENTRYTALLY Payroll ENTRY
TALLY Payroll ENTRYargusacademy
 
COMPUTER Tips ‘n’ Tricks
COMPUTER Tips ‘n’   TricksCOMPUTER Tips ‘n’   Tricks
COMPUTER Tips ‘n’ Tricksargusacademy
 

En vedette (20)

Application software
Application softwareApplication software
Application software
 
VISUAL BASIC .net iii
VISUAL BASIC .net iiiVISUAL BASIC .net iii
VISUAL BASIC .net iii
 
Php opps
Php oppsPhp opps
Php opps
 
VISUAL BASIC .net vi
VISUAL BASIC .net viVISUAL BASIC .net vi
VISUAL BASIC .net vi
 
Java script
Java scriptJava script
Java script
 
TALLY Service tax & tds ENTRY
TALLY Service tax & tds ENTRYTALLY Service tax & tds ENTRY
TALLY Service tax & tds ENTRY
 
TALLY 1 st level entry
TALLY 1 st level entryTALLY 1 st level entry
TALLY 1 st level entry
 
VISUAL BASIC .net iv
VISUAL BASIC .net ivVISUAL BASIC .net iv
VISUAL BASIC .net iv
 
Multimedia basic
Multimedia basicMultimedia basic
Multimedia basic
 
1 tally basic
1 tally basic1 tally basic
1 tally basic
 
Computer development
Computer developmentComputer development
Computer development
 
VISUAL BASIC .net ii
VISUAL BASIC .net iiVISUAL BASIC .net ii
VISUAL BASIC .net ii
 
TALLY Pos ENTRY
TALLY Pos ENTRYTALLY Pos ENTRY
TALLY Pos ENTRY
 
Paint
PaintPaint
Paint
 
C programming file handling
C  programming file handlingC  programming file handling
C programming file handling
 
C programming flow of controls
C  programming flow of controlsC  programming flow of controls
C programming flow of controls
 
Virus examples
Virus examplesVirus examples
Virus examples
 
TALLY Payroll ENTRY
TALLY Payroll ENTRYTALLY Payroll ENTRY
TALLY Payroll ENTRY
 
COMPUTER Tips ‘n’ Tricks
COMPUTER Tips ‘n’   TricksCOMPUTER Tips ‘n’   Tricks
COMPUTER Tips ‘n’ Tricks
 
Php basic
Php basicPhp basic
Php basic
 

Similaire à C++ programming structure & union

Similaire à C++ programming structure & union (20)

C programming structure & pointer
C  programming structure & pointerC  programming structure & pointer
C programming structure & pointer
 
Pads lab manual final
Pads lab manual finalPads lab manual final
Pads lab manual final
 
Programs of C++
Programs of C++Programs of C++
Programs of C++
 
CBSE Class XI Programming in C++
CBSE Class XI Programming in C++CBSE Class XI Programming in C++
CBSE Class XI Programming in C++
 
basic programs in C++
basic programs in C++ basic programs in C++
basic programs in C++
 
RAILWAY RESERWATION PROJECT PROGRAM
RAILWAY RESERWATION PROJECT PROGRAMRAILWAY RESERWATION PROJECT PROGRAM
RAILWAY RESERWATION PROJECT PROGRAM
 
Ccc
CccCcc
Ccc
 
Cpp c++ 1
Cpp c++ 1Cpp c++ 1
Cpp c++ 1
 
Railwaynew
RailwaynewRailwaynew
Railwaynew
 
C++ practical
C++ practicalC++ practical
C++ practical
 
C program
C programC program
C program
 
Student Data Base Using C/C++ Final Project
Student Data Base Using C/C++ Final ProjectStudent Data Base Using C/C++ Final Project
Student Data Base Using C/C++ Final Project
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for Railway reservation
 
Railway reservation
Railway reservationRailway reservation
Railway reservation
 
Cs pritical file
Cs pritical fileCs pritical file
Cs pritical file
 
Pointers
PointersPointers
Pointers
 
P1
P1P1
P1
 
C++ Programming - 1st Study
C++ Programming - 1st StudyC++ Programming - 1st Study
C++ Programming - 1st Study
 
C++ L07-Struct
C++ L07-StructC++ L07-Struct
C++ L07-Struct
 
12. stl örnekler
12.  stl örnekler12.  stl örnekler
12. stl örnekler
 

Plus de argusacademy (20)

Css & dhtml
Css  & dhtmlCss  & dhtml
Css & dhtml
 
Html table
Html tableHtml table
Html table
 
Html ordered & unordered list
Html ordered & unordered listHtml ordered & unordered list
Html ordered & unordered list
 
Html level ii
Html level  iiHtml level  ii
Html level ii
 
Html frame
Html frameHtml frame
Html frame
 
Html forms
Html formsHtml forms
Html forms
 
Html creating page link or hyperlink
Html creating page link or hyperlinkHtml creating page link or hyperlink
Html creating page link or hyperlink
 
Html basic
Html basicHtml basic
Html basic
 
Php string
Php stringPhp string
Php string
 
Php session
Php sessionPhp session
Php session
 
Php oops1
Php oops1Php oops1
Php oops1
 
Php if else
Php if elsePhp if else
Php if else
 
Php creating forms
Php creating formsPhp creating forms
Php creating forms
 
Php create and invoke function
Php create and invoke functionPhp create and invoke function
Php create and invoke function
 
Php array
Php arrayPhp array
Php array
 
Sql query
Sql querySql query
Sql query
 
Rdbms
RdbmsRdbms
Rdbms
 
Oracle
OracleOracle
Oracle
 
Vb.net iv
Vb.net ivVb.net iv
Vb.net iv
 
Vb.net iii
Vb.net iiiVb.net iii
Vb.net iii
 

Dernier

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jisc
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024Elizabeth Walsh
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Pooja Bhuva
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 

Dernier (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)Jamworks pilot and AI at Jisc (20/03/2024)
Jamworks pilot and AI at Jisc (20/03/2024)
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 

C++ programming structure & union

  • 1.
  • 6. #include<iostream.h> #include<conio.h> struct student { char name[20]; int marks; float per; }; void main() { struct student stu; clrscr(); cout<<“Enter Student Namen”; gets(stu.name); cout<<“Enter Student Marksn”; cin>>stu.marks; cout<<“Enter Percentagen”; cin>>stu.per; cout<<“NAME :”; puts(stu.name); cout<<“MARKS :”<<stu.marks<<“n”; cout<<“PERCENTAGE :”<<stu.per<<“n”; getch(); } EXTRA
  • 7. #include<iostream.h> Structure within structure #include<conio.h> struct address { char street[10]; char city[10]; char state[10]; }; struct employee { char name[20]; char des[10]; struct address add; int salary; }; void main() { struct employee emp; clrscr(); cout<<"Enter Employee detailsn”; cout<<"Enter Namen"; gets(emp.name); EXTRA
  • 8. cout<<"Enter Designationn”; gets(emp.des); cout<<"Enter Addressn"; cout<<"Enter street n”; gets(emp.add.street); cout<<"Enter Cityn"; gets(emp.add.city); cout<<"Enter Staten"; gets(emp.add.state); cout<<"Enter Slalryn”; cin>>emp.salary; cout<<"EMPLOYEE DETAILSn”; cout<<"NAME :”; puts(emp.name); cout<<"DESIGNATION :”; puts(emp.des); cout<<"ADDRESS :n”; cout<<"STREET :”; puts(emp.add.street); cout<<"CITY :”; puts(emp.add.city); cout<<"STATE :"; puts(emp.add.state); cout<<"SALARY :”<<emp.salary<<“n” ; getch(); } EXTRA
  • 11. #include<stdio.h> #include<conio.h> union marks { int phy; int che; int mat; int total; float per; }s1; void main() { clrscr(); cout<<“Enter Marks detailsn”; cout<<"Enter physics marksn”; cin>>s1.phy; cout<<"Enter chemistry marksn”; cin>>s1.che; cout<<"Enter Math Marksn”; cin>>s1.mat; s1.total=s1.phy+s1.che+s1.mat; cout<<"Total Marks = “<<s1.total <<“n”; s1.per=s1.total*1/3; cout<<"Percentage = ”<<s1.pern”; getch(); } EXTRA