fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. double a, b, x;
  6. int n = 0;
  7. while (cin >> a >> b)
  8. {
  9. cout << ++n << ") ";
  10. if (a == 0)
  11. {
  12. if (b == 0) cout << "Infinite set of roots; \n";
  13. else cout << "No roots; \n";
  14. }
  15. else
  16. {
  17. x = (-b/a == -0)? b/a : -b/a;
  18. cout << x << "; \n";
  19. }
  20. }
  21. return 0;
  22. }
Success #stdin #stdout 0s 4188KB
stdin
0 0 1 0 0 1
stdout
1) Infinite set of roots; 
2) 0; 
3) No roots;