By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,389 Members | 1,847 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,389 IT Pros & Developers. It's quick & easy.

C++ homework problem

P: 6
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.
Jun 11 '07 #1
Share this Question
Share on Google+
5 Replies


sicarie
Expert Mod 2.5K+
P: 4,677
Have a look at this.

What do you have so far?
Jun 11 '07 #2

P: 23
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
Jun 11 '07 #3

ilikepython
Expert 100+
P: 844
Also, give better titles to your threads, please. "Please help in C++", doesn't tell us anything.
Jun 11 '07 #4

Expert 10K+
P: 11,448
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
Jun 11 '07 #5

Expert 10K+
P: 11,448
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
Jun 11 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.