Menu

Custom Search

C++ lab Program

#include
#include
enum boolean{false,true};
class vector
{
float i,j,k;
public: vector(float a=0,float b=0,float c=0):i(a),j(b),k(c){};

void getdata(){
cout<<"Enter value of i, j and k"<>i>>j>>k;
}

friend boolean operator ==(vector,vector);
void display(){
cout<<"Vector(V)="< };
boolean operator==(vector v,vector v1)
{ if(v.i==v1.i && v.j==v1.j && v.k==v1.k)
return true;
else
return false;
}
void main()
{
clrscr();
vector v;
v.getdata();
vector v1.getdata();
if(v==v1)
cout<<"V == v1";
else
cout<<" V !=v1";
v.display();
v1.display();

getch();
}

No comments:

Post a Comment