Skip to content

Instantly share code, notes, and snippets.

@hsandid
Created February 8, 2018 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hsandid/b09aa4bfbb6561a29bae691faefaae8f to your computer and use it in GitHub Desktop.
Save hsandid/b09aa4bfbb6561a29bae691faefaae8f to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int main()
{
cout<<"This Program allows you to solve equations of two unknowns";
cout<<"\n\nPlease Input your coefficients in the following format:\n\nx1\ny1\nz1";
cout<<"\nx2\ny2\nz2\n";
double x,y,x1,x2,y1,y2,z1,z2;
cin>>x1;
cin>>y1;
cin>>z1;
cin>>x2;
cin>>y2;
cin>>z2;
x=((-(y2/y1)*z1)+z2)/((-(y2/y1)*x1)+x2);
y=((-(x2/x1)*z1)+z2)/((-(x2/x1)*y1)+y2);
cout<<"The value of x is "<<x<<endl;
cout<<"the value of y is "<<y<<endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment