Find us On Facebook

Showing posts with label to find out the total and average of student. Using structure within structure. Show all posts
Showing posts with label to find out the total and average of student. Using structure within structure. Show all posts

Wednesday, April 6, 2011

W.A.P to find out the total & average of student. Using structure within structure


#include<iostream.h>
#include<conio.h>
            struct student {
                        char nm[20];
                        int total;
                        float avg;
            struct marks {
                        int m1,m2,m3;
            };
            struct marks m;
            };

            void main()
             {
            struct  student s;
              clrscr();
              cout<<"Enter the Name of the Student.....     ";
              cin>>s.nm;
              cout<<"Enter the marks of Three Subjects....  ";
              cin>>s.m.m1>>s.m.m2>>s.m.m3;
              s.total = s.m.m1+s.m.m2+s.m.m3;
              s.avg=s.total/3.0;
             
              cout<<"\n\n\n\n\n\n\n\t\t===============================================";
              cout<<"\n\n\t\t The Name of the student is "<<s.nm;
              cout<<"\n\t\t The Total Marks of the Student is "<<s.total;
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      cout.precision(2);
              cout<<"\n\t\t The Average of the student is "<<s.avg;
              cout<<"\n\t\t===============================================";
              getch();
             }





OUTPUT:




Enter the Name of the Student.....     R GABA
Enter the marks of Three Subjects....  90
80
70



                ===============================================

                 The Name of the student is R GABA
                 The Total Marks of the Student is 240
                 The Average of the student is 80
                ===============================================

Programms

C,C++,VB, PL/SQL EBOOK SEARCH ENGINE