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;
Asks the user for an integer. if the number is less than 21, ask them for a number again; repeat this until you get a number bigger than 20. 20 is not an acceptable number. Once yo
Overall Program Objective: You will design and simulate a basic RISC processor. You will create and encode an instruction set. Your final task will be to "compile" a program
Define Functions with arguments and no return values The calling function will read a data from the terminal and pass it on to called as function and this will work good as the
Using the Constructor There are basically three ways of creating and initializing the object. The first way to call the constructor is explicitly as :
Question 1: (a) Explain clearly the following concepts using suitable examples of your own:- (i) concrete class v/s abstract class (ii) constructor v/s over
Newton's method for cube roots is based on the fact that if y is an approximation to the cube root of x, then a better approximation is given by the value: (x/y 2 +2y)/3 (a)
Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various luminous jewels of particular colour. Nec
write a c progrm to find area under the cuve y=f(x) #include float start_point, /* GLOBAL VARIABLES */ end_point, total_area; in
help with deciphering
There is a pebble merchant. He sells the pebbles, that are used for shining the floor. His main duty is to take the length of the room’s sides. But he sometimes mistakes doing that
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: +1-415-670-9521
Phone: +1-415-670-9521
Email: [email protected]
All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd