Back To C++ Structures
nested structure means structure within a structure
//program to create a structure marks with members (physics,chemistry,maths and total) array of structure marks is created and total marks are calculated for each student #include
#include
struct student { int rollno; int maths; int chemistry; int physics; int total; }; void main() { clrscr(); student a[3]; int i; cout<<"\nenter the data "; for(i=0;i<3;i++) { cout<<"\nenter rollno "; cin>>a[i].rollno; cout<<"\nenter maths"; cin>>a[i].maths; cout<<"\nenter chemistry "; cin>>a[i].chemistry; cout<<"\nenter physics"; cin>>a[i].physics; a[i].total=a[i].physics+a[i].maths+a[i].chemistry; cout<<"\ntotal marks are "<