Introducing Radical.sh

Forget Code launches a powerful code generator for building API's

Arithmetic Operation in C++

//arithmetic operations
#include<iostream.h>
#include<conio.h>
class arithmetic
{
public:
void add(int a,int b)
{
int c=a+b;
cout<<"\naddition:"<<c;
}
void sub(int c,int d)
{
int e=c-d;
cout<<"\nsubtraction:"<<e;
}
void mul(int x,int y)
{
int z=x*y;
cout<<"\nMultiply:"<<z;
}
void div(int p,int q)
{
float r=p/q;
cout<<"\nDivision:"<<r;
}
};
void main()
{
arithmetic a;
int first, second;
cout<<"Enter two integrs:";
cin>>first>>second;
a.add(first,second);
a.sub(first,second);
a.mul(first,second);
a.div(first,second);
getch();
}



Output:
Enter two integrs:6 6
addition:12
subtraction:0
Multiply:36
Division:1