/*Using class write a program that would be able to do the following task:
a) To create the vector.
b) To add the value of a two vector
c) To display the vector in the form (ai+bj+ck)
*/
#include <iostream>
using namespace std;
#include<stdlib.h>
class vector
{ float i,j,k;
int n;
public:
void create();
void show();
friend void add(vector,vector);
};
void vector::create()
{
cout<<“Enter the value for i,j,k: “;
cin>>i>>j>>k;
}
void vector::show()
{cout<<“The vector is: “<<i<<“i+”<<j<<“j+”<<k<<“k”<<endl;
}
void add(vector a,vector b)
{
vector c;
c.i=a.i+b.i;
c.j=a.j+b.j;
c.k=a.k+b.k;
cout<<“After summation “;
c.show();
}
int main()
{ vector p,q;
p.create();
p.show();
q.create();
q.show();
add(p,q);
}