Overloading binary operators, C/C++ Programming

Overloading Binary Operators

class SI

{float i,p,n,r,a;

public:

SI(){};

SI(int gp,int gn, int gr);

void putdata(void);

SI operator+(SI);

};

SI SI::operator+(SI i1)

{SI i2; i2.p=p+i1.p; i2.i=i+i1.i; i2.a=a+i1.a; return i2;

}

void SI::putdata(void)

{cout<<"Principle is: "<

cout<<"Interest is "<

cout<<"Amount is "<

}

SI::SI(int gp,int gn, int gr)

{p=gp;n=gn;r=gr; i=(p*n*r)/100; a=p+i;

}

int main()

{           SI i1,i2,i3;

i1=SI(1000,2,10); i1.putdata(); cout<

return 0;

}

Posted Date: 9/20/2012 8:18:17 AM | Location : United States







Related Discussions:- Overloading binary operators, Assignment Help, Ask Question on Overloading binary operators, Get Answer, Expert's Help, Overloading binary operators Discussions

Write discussion on Overloading binary operators
Your posts are moderated
Related Questions
Many modern cryptography algorithms require two numbers that are coprime, or sometimes referred to as relatively prime. Two numbers are coprime if their greatest common divisor is

Hi is there any chance to get assignment for fresher tutor

What are pre-processor directives? - Pre-processor directives are placed at the beginning of a C program. They begin with # symbol. - This is the place, where library files

How can I handle a destructor that fails? Need help please provide example also.

Project Description: Seeking a Voting Bot Script / Program Skills required are ASP, Javascript, C Programming, PHP, Software Architecture

types of lists

What is MIME? MIME - Multi-purpose Internet Mail Extensions. MIME types signifies a standard way of classifying file types over Internet. Browsers and Web servers have

Explain each of the algorithms in a way that would be understandable to an intelligent person who is not familiar with programming. You should not use any code (or even pseudo code

Smugglers are becoming very smart day by day. Now they have developed a new technique of sending their messages from one smuggler to another. In their new technology, they are send

A:  it is containing and hiding Information regarding an object, like internal data structures and code. It isolates the internal complication of an object's operation from the res