SlideShare a Scribd company logo
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

More Related Content

What's hot

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
 

What's hot (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
 

Viewers also liked

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
 

Viewers also liked (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
 

Similar to C++ programming structure & union

Similar to 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
 
Railway reservation
Railway reservationRailway reservation
Railway reservation
 
c++ program for Railway reservation
c++ program for Railway reservationc++ program for Railway reservation
c++ program for 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
 

More from 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
 

Recently uploaded

The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonSteve Thomason
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesRased Khan
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxJheel Barad
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resourcesdimpy50
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfTamralipta Mahavidyalaya
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringDenish Jangid
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptxmansk2
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsCol Mukteshwar Prasad
 
Advances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdfAdvances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdfDr. M. Kumaresan Hort.
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptSourabh Kumar
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...Nguyen Thanh Tu Collection
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaasiemaillard
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345beazzy04
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxakshayaramakrishnan21
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online PresentationGDSCYCCE
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...Denish Jangid
 

Recently uploaded (20)

The Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve ThomasonThe Art Pastor's Guide to Sabbath | Steve Thomason
The Art Pastor's Guide to Sabbath | Steve Thomason
 
Application of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matricesApplication of Matrices in real life. Presentation on application of matrices
Application of Matrices in real life. Presentation on application of matrices
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Benefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational ResourcesBenefits and Challenges of Using Open Educational Resources
Benefits and Challenges of Using Open Educational Resources
 
NCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdfNCERT Solutions Power Sharing Class 10 Notes pdf
NCERT Solutions Power Sharing Class 10 Notes pdf
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & EngineeringBasic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
Basic Civil Engg Notes_Chapter-6_Environment Pollution & Engineering
 
2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx2024_Student Session 2_ Set Plan Preparation.pptx
2024_Student Session 2_ Set Plan Preparation.pptx
 
How to Break the cycle of negative Thoughts
How to Break the cycle of negative ThoughtsHow to Break the cycle of negative Thoughts
How to Break the cycle of negative Thoughts
 
Advances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdfAdvances in production technology of Grapes.pdf
Advances in production technology of Grapes.pdf
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.pptBasic_QTL_Marker-assisted_Selection_Sourabh.ppt
Basic_QTL_Marker-assisted_Selection_Sourabh.ppt
 
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
50 ĐỀ LUYỆN THI IOE LỚP 9 - NĂM HỌC 2022-2023 (CÓ LINK HÌNH, FILE AUDIO VÀ ĐÁ...
 
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
Operations Management - Book1.p  - Dr. Abdulfatah A. SalemOperations Management - Book1.p  - Dr. Abdulfatah A. Salem
Operations Management - Book1.p - Dr. Abdulfatah A. Salem
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Salient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptxSalient features of Environment protection Act 1986.pptx
Salient features of Environment protection Act 1986.pptx
 
[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation[GDSC YCCE] Build with AI Online Presentation
[GDSC YCCE] Build with AI Online Presentation
 
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...Basic Civil Engineering Notes of Chapter-6,  Topic- Ecosystem, Biodiversity G...
Basic Civil Engineering Notes of Chapter-6, Topic- Ecosystem, Biodiversity G...
 
Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......Ethnobotany and Ethnopharmacology ......
Ethnobotany and Ethnopharmacology ......
 

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