Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <windows.h>
- #include <iostream>
- using namespace std;
- int main()
- {
- double a1, b1, c1;
- double a2, b2, c2;
- cout << "input a1: ";
- cin >> a1;
- cout << "input b1: ";
- cin >> b1;
- cout << "input c1: ";
- cin >> c1;
- cout << "input a2: ";
- cin >> a2;
- cout << "input b2: ";
- cin >> b2;
- cout << "input c2: ";
- cin >> c2;
- double x, y;
- if (((a1 != 0) || (b1 != 0)) && ((a2 != 0) || (b2 != 0))) {
- if ((a1 == a2) && (b1 == b2) && (c1 == c2))
- cout << "lines coincide" << endl;
- else if ((a1 == a2) && (b1 == b2) && (c1 != c2))
- cout << "lines don't overlap" << endl;
- else {
- y = (c2 - (a2 * c1 / a1)) / ((((-(a2)) * c1) / a1) + b2);
- x = (c1 - b1 * y) / a1;
- cout << "lines ovelap: ";
- cout << "x = " << x << ", y = " << y << endl;
- }
- }
- else if (((a1 == 0) && (b1 == 0)) && ((a2 != 0) || (b2 != 0)))
- cout << "first line doesn't exist" << endl;
- else if (((a2 != 0) || (b2 != 0)) && ((a1 == 0) && (b1 == 0)))
- cout << "second line doesn't exist" << endl;
- else if ((a2 == 0) && (b2 == 0) && (a1 == 0) && (b1 == 0))
- cout << "both lines don't exist" << endl;
- else cout << "wrong input" <<
- system("pause");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement