title: Define a class student with the following specification (remaining que below)
body: <p>I dont understand why i am not getting total.</p>
  
  <p>The question is</p>
  
  <blockquote>
    <p>Define a class student with the following specification:Private
    members of class student admno integer sname 20 character eng.<br>
    math, science float total float ctotal() a function to calculate eng +
    math +     science with float return type. Public member function of
    class student     Takedata() Function Public member function of class
    student Takedata() Function     float ctotal() a function to calculate
    eng + math + science with floa return     type. Public member function
    of class student Takedata() Function</p>
  </blockquote>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;iostream&gt;
  using namespace std;
  class Student
  {
      private:
      int admno;
      char sname[20];
      float english,maths,science;
      float total;
      float ctotal()
      {
          total=(english+maths+science);
          return(total);
      }
      public:
          void Takedata()
          {
              cout&lt;&lt;"Enter the value of admno:";
              cout&lt;&lt;" sname :";
              cout&lt;&lt;"eng :";
              cout&lt;&lt;"science:";
              cout&lt;&lt;"maths:";
              cin&gt;&gt;admno;
  
              cin&gt;&gt;sname;
  
              cin&gt;&gt;english;
  
              cin&gt;&gt;science;
  
              cin&gt;&gt;maths;
  
          }
          Student(): total(0.0)  //constructor
          {
          }
          friend float func(Student);
          void Showdata()
          {
              cout&lt;&lt;"adm no:"&lt;&lt;admno;
              cout&lt;&lt;"sname:"&lt;&lt;sname;
              cout&lt;&lt;"eng"&lt;&lt;english;
              cout&lt;&lt;"science"&lt;&lt;science;
              cout&lt;&lt;"maths"&lt;&lt;maths;
          }
  };
     float func(Student t)
     {
      t.total;
      return t.total;
     }
     int main()
     {
      Student s1;
      s1.Takedata();
      s1.Showdata();
      cout&lt;"total is:";
      cout&lt;&lt;func(s1);
  
     }
  </code></pre>