Using friend function multiply two number in c ++

using namespace std;
#include<iostream>
#include<conio.h>
class xyz;
class abc
{
private:
int a;
int b;
public:
void input();
friend void mul(abc,xyz);
};
void abc::input()
{
cout<<"\n enter  the value of a:";
cin>>a;
cout<<"\n enter  the value of b:";
cin>>b;
}
class xyz
{
 private:
  int x;
  int y;
  public:
  void input();
  friend void mul(abc,xyz);
  };
  void xyz::input()
  {
  cout<<"\n enter the value of x:";
  cin>>x;
  cout<<"\n ennter the value of y:";
  cin>>y;
 }
 void mul(abc a1,xyz x1)
 {
  int t,s;
  t=a1.a*x1.x;
  s=a1.b*x1.y;
  cout<<"\n "<<"a"<<"*"<<"x"<<"="<<t;
  cout<<"\n "<<"b"<<"*"<<"y"<<"="<<s;
  }
  int main()
  {
  abc A;
  xyz X;
  A.input();
  X.input();
  mul(A,X);
  return 0;
 
 
  }


Comments