C++ homework problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • king imran
    New Member
    • Jun 2007
    • 6

    C++ homework problem

    Write a program which consists of a class named Student, the class should consists of three data members Name, Ob_marks, Total_marks and two member functions Cal_percentage( ) which calculate the percentage of the student by the formula (Ob_marks * 100 )/Total_marks and Display() which show all information of the student. The class should also contain the default constructor which initializes all the data member of the class.
    In main program define an object of the Student class and call the member functions with this object.
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    Have a look at this.

    What do you have so far?

    Comment

    • ssorower
      New Member
      • May 2007
      • 23

      #3
      Hi Imran!

      Its a very simple program in C++. You should try yourself. If you face any specific problem then anyone here can help you figure it out. But if you get the absolute solution here, it doesnt help your learning.

      Hints for you: All you need to do is define a Student class, define private member variables and two public member functions (you need to call from from main), and a constructor (same as any member function just there is no return type and the function name is same as the class name).

      But, I am sure you will find similar kind of program in any C++ book :)

      --Sorower

      Comment

      • ilikepython
        Recognized Expert Contributor
        • Feb 2007
        • 844

        #4
        Also, give better titles to your threads, please. "Please help in C++", doesn't tell us anything.

        Comment

        • JosAH
          Recognized Expert MVP
          • Mar 2007
          • 11453

          #5
          Originally posted by ilikepython
          Also, give better titles to your threads, please. "Please help in C++", doesn't tell us anything.
          I just changed the title to something more appropriate.

          kind regards,

          Jos

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by king imran
            Write a program which consists of a class named Student, the class should consists of three data members Name, Ob_marks, Total_marks and two member functions Cal_percentage( ) which calculate the percentage of the student by the formula (Ob_marks * 100 )/Total_marks and Display() which show all information of the student. The class should also contain the default constructor which initializes all the data member of the class.
            In main program define an object of the Student class and call the member functions with this object.
            Good; you know how to copy and paste your homework text. What have you
            tried yourself sofar? We're happy to help you but we're not going to do your
            homework for you. You have to learn and we're willing to help; that's the formula.

            kind regards,

            Jos

            Comment

            Working...