Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a,b,c;
- bool s = 1;
- cin >> a >> b >> c;
- if (a != 0)
- {
- cout << a;
- s = 0;
- }
- if (b != 0)
- {
- if (b == 1)
- {
- if (a == 0)
- cout << "x";
- else
- cout << "+x";
- }
- else if (b == -1)
- cout << "-x";
- else if ((b < 0) or (a == 0))
- cout << b << "x";
- else
- cout << "+" << b << "x";
- s = 0;
- }
- if (c != 0)
- {
- if (c == 1)
- {
- if ((a == 0) and (b == 0))
- cout << "y";
- else
- cout << "+x";
- }
- else if (c == -1)
- cout << "-y";
- else if ((c < 0) or ((a == 0) and (b == 0)))
- cout << c << "y";
- else
- cout << "+" << c << "y";
- s = 0;
- }
- if (s)
- cout << 0;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement