Write a C++ program using function (pass by reference) that calculates the value of x nad y from the two linear equations

#include<iostream>
using namespace std;
void fun (int a,int b,int c,int d,int m,int n,int x,int y);
int main()
{


int *a,*b,*c,*d
cout << "Enter the value of a and b in ax+by=m";
cin >> a >> b;
cout << "Enter the value of c and d in cx+dy=n";
cin >> c >> d;
x1=fun(a,b,c,d,x,y);
y1=fun(a,b,c,d,x,y);
cout << "\nValue of x is :"<<x1;
cout << "\nValue of y is :"<<y1;
}
fun (int a,int b,int c,int d,int m,int n,int x,int y)
{
x=(m*d-b*n)/(a*d-c*b);
y=(n*a-m*c)/(a*d-c*b);
return x;
return y;
}

Post a Comment

0 Comments