Turn Desktop View Off
by Dinesh Thakur Category: Array Pointer and Union



void main ( )
            struct student
              int subject1 ;
              int subject2 ;
              int subject3 ;
               int i , n, total;
               float av ;
               struct student st[20];
               cout<<" \n Enter the Number of Students : " ;
               cin>> n ;
               for (i =0; i<n; i++)
                          cout<<"\nEnter Marks of three Subjects of "<<i+1<<" Student : " ;
                          total = 0 ;
                          cin>> st[i].subject1 >>st[i].subject2>>st[i].subject3;
                          total = st[i].subject1+st[i].subject2+st[i].subject3;
                          av = (float) total /3 ;
                          cout<<"\nAVERAGE Marks of " <<i+1<<" Student is = "<< av ;
                          getch( );

Class By Using Array Of Structure

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles