Already have an account? Get multiple benefits of using own account!
Login in your account..!
Remember me
Don't have an account? Create your account in less than a minutes,
Forgot password? how can I recover my password now!
Enter right registered email to receive password!
Function Returning Object:
This program is like to the previous program except the function returns object. The
main rule to be remembered is the function returning object must be defined as friend function in the class.
class interest
{float i,p,n,r,a;
public:
void getdata(int gp, int gn, int gr);
void putdata(void)
{cout<<"Interest is "<
cout<<"Amount is "< } Friend interest suminterest(interest,interest); }; void interest::getdata(int gp,int gn, int gr) {p=gp;n=gn;r=gr; cout<<"Enter Principal: "<<"\n"; cin>>p; cout<<"Enter Year: "<<"\n"; cin>>n; cout<<"Enter Rate: "<<"\n"; cin>>r; i=(p*n*r)/100; a=p+i; } interest suminterest(interest i1, interest i2) {interest i3; i3.i=i1.i+i2.i; i3.a=i1.a+i2.a; return i3; } int main() {clrscr(); interest i1,i2,i3; i1.getdata( 1000,10,2); i1.putdata(); i2.getdata(10000,8,3); i2.putdata(); i3 = suminterest(i1,i2); i3.putdata(); return 0; }
}
Friend interest suminterest(interest,interest);
};
void interest::getdata(int gp,int gn, int gr)
{p=gp;n=gn;r=gr;
cout<<"Enter Principal: "<<"\n";
cin>>p;
cout<<"Enter Year: "<<"\n";
cin>>n;
cout<<"Enter Rate: "<<"\n";
cin>>r; i=(p*n*r)/100; a=p+i;
interest suminterest(interest i1, interest i2)
{interest i3; i3.i=i1.i+i2.i; i3.a=i1.a+i2.a; return i3;
int main()
{clrscr();
interest i1,i2,i3; i1.getdata( 1000,10,2); i1.putdata(); i2.getdata(10000,8,3); i2.putdata();
i3 = suminterest(i1,i2);
i3.putdata();
return 0;
#include stdio.h> #include conio.h> #include ctype.h> #include string.h> void main() { int i=0,j=0,length; char a[30]; cl
E v o l u t i o n of Software: In the past stage of programming the software's were developed in Machine language Using binary numbers 1's and 0's. Later it convert
Algorithm to find the value of the powers raised by integer
Question: (a) Describe what are dynamic pointers. Show their memory representations diagrammatically. (b) Write short notes about pointers in arrays, paying attention on
Project Description: Boots capture video from your YouTube channel and upload your own video to our channel or the copyright of the videos, bang, 3 parties, automatically delete
It is a pointer accessible only in the member functions of a struct, class or union type. It points to the object for which the member function is called. Static member functions d
#include #include #include #include #include class Employee { private: char *Name; //Set them as pointers... int IdNumber; char *Department; char *Position; public: voi
The code contains two built-in pitfalls. First one, if it executes in a member function for an static, extern or automatic object, the program will possibly crash as soon as the de
Polymorphism C++ supports this idea - that different objects do "the right thing "- by function polymorphism and class polymorphism. Poly means many, while morph means form.
Define the Assignment Operators in c language? The assignment operators can be used to assign a value to the variable and is represented by equal to (=) sign. The Assignment ex
Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!
whatsapp: +91-977-207-8620
Phone: +91-977-207-8620
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd