Overloading binary operators, C/C++ Programming

Overloading Binary Operators

class SI

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



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
Function Overloading Function overloading is a form of polymorphism. Function overloading facilitates explaining one function having many forms. In other words it facilitates e

Write a simple generic version of method isEqualTo that compares its two arguments with the equals method and returns true if they are equal and false otherwise. Use this generic m

Need an indicator Project Description: Need an indicator which indicates target and trailing sl after entering trades. Skills required are C Programming, C++ Programming,

how to do 2, 4, 8 associativity

Conversion from Basic to User-Defined variable Consider the following example. class Distance                  {                   public  :

Manipulators There are several classes in the iostream.h header file. One of them is ios class. This class stores the format state. For example, some bits explain the base in w

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''''a''''-''''z'''') and

Structure of C++ Program: Chronological order of C++ program. 1.   Class declaration 2.   Main function program 3.   Member functions definitions 4.   Include heade

Project Description: Project is related indexing data related some data structure. I need to share all information related project later if i contact any body Skills required

i havea a small C++ i need help with. should not be anything special for an experienced programmer