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

cannot compile this program please correct it i

P: n/a
Question # 1 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.

Question # 2

What is function overloading Is it possible to overload constructor if
Yes give complete example of constructor overloading, if No justify
your answer.

Jun 14 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
mo**************@gmail.com wrote:
Question # 1 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.

Question # 2

What is function overloading Is it possible to overload constructor if
Yes give complete example of constructor overloading, if No justify
your answer.
The subject states "cannot compile this program please correct it i".
Ignoring the 'i' at the end (which might mean it's part one or smth),
I still am unable to understand what you're asking. There is *NO*
program in your message for us to correct. Please post your code.

Also, check out FAQ section 5.

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Jun 14 '07 #2

P: n/a
mo**************@gmail.com wrote:
Question # 1 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.

Question # 2

What is function overloading Is it possible to overload constructor if
Yes give complete example of constructor overloading, if No justify
your answer.
Lol, James, you were right! He's back! lol!

Regards,

Zeppe
Jun 14 '07 #3

P: n/a
mo**************@gmail.com wrote:
Question # 1 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.

Question # 2

What is function overloading Is it possible to overload constructor if
Yes give complete example of constructor overloading, if No justify
your answer.
Your problem is a FAQ. Please FAQ 5.2,
http://www.parashift.com/c++-faq-lit...t.html#faq-5.2
Jun 14 '07 #4

P: n/a
<mo**************@gmail.comwrote:
Question # 1 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.
I think you need a better dictionary to translate between English and your
native language. In particular, find out what the word "this" means.

Unfortunately, the answer to your question has been posted in bits and
pieces during the last few days. It is now up tot you either write a
program or fit the bits and pieces together, which means deciding which bits
to keep, which to discard, which to modify and so on. After you have
assembled something you like (or can live with), compile and run it. If
you have problems, embed the entire body of code in a message to the
newsgroup along with a question. Embed means cut and paste.
Jun 14 '07 #5

P: n/a

<mo**************@gmail.comwrote in message
news:11*********************@d30g2000prg.googlegro ups.com...
Question # 1 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.

Question # 2

What is function overloading Is it possible to overload constructor if
Yes give complete example of constructor overloading, if No justify
your answer.
#include <string>

int main()
{
std::string Text = " Question # 1 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.\
\
Question # 2\
\
What is function overloading Is it possible to overload constructor if\
Yes give complete example of constructor overloading, if No justify\
your answer.";
}

That should fix your typos.
Jun 15 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.