I can't read arry go on ( inside ) the object ,,,, and I don't know to use
overloding (> ,< ,!= ,== ) truthly .
but this is that i write and I can to arrive to it
here
#include<iostream>
#include<string>
#include<ctype.h>
using namespace std;
using std::istream;
using std::ostream;
class samp {
int n,m,o;
public:
samp (int i=0,int l=0,int j=0 )
{
n=i;
m=l;
o=j;
}
samp operator+(samp ob)
{
samp temp;
temp.n=n+ob.n;
temp.m=m+ob.m;
temp.o=o+ob.o;
return temp;
}
samp operator-(samp ob)
{
samp temp;
temp.n=n-ob.n;
temp.m=m-ob.m;
temp.o=o-ob.o;
return temp;
}
bool operator==(samp ob);
void print()
{
cout<<n<<" "<<m<<" "<<o<<"\n";
}
};
bool samp::operator ==(samp right)
{
if(n==right.n&&m==right.m&&o==right.o)
return true;
else
return false;
}
int main()
{
int choice;
samp A(1,2,3);
samp B(3,2,1);
cout<<"\n";
samp C;
while (choice!=2)
{
cout<<"what do you want to do..\n";
cout<<"1-Add two object..\n";
cout<<"2-Subtract two object..\n";
cout<<"3-com two object..\n";
cout<<"4-Exit..\n";
cout<<" SELECT" ;
cin>>choice;
switch(choice)
{
case 1:
C=A+B;
C.print();
break;
case 2:
C=A-B;
C.print();
break;
case 3:
A==B;
case 4:
break;
default:
cout<<" Invalid choice !\n";
}
cout<<endl<<"---------------------------------------------";
}
return 0;
}