#include #include #pragma GCC diagnostic ignored "-Wdiv-by-zero" using namespace std; void ex0() { int a; cin >> a; // Please, don't do this, it's really ugly if (a / 100 > 0) cout << (a / 100) << " * 100" << (((a %= 100) > 0) ? " + " : ""); if (a / 50 > 0) cout << (a / 50) << " * 50" << (((a %= 50) > 0) ? " + " : ""); if (a / 20 > 0) cout << (a / 20) << " * 20" << (((a %= 20) > 0) ? " + " : ""); if (a / 10 > 0) cout << (a / 10) << " * 10" << (((a %= 10) > 0) ? " + " : ""); if (a / 5 > 0) cout << (a / 5) << " * 5" << (((a %= 5) > 0) ? " + " : ""); if (a / 2 > 0) cout << (a / 2) << " * 2" << (((a %= 2) > 0) ? " + " : ""); if (a > 0) cout << a << " * 1"; } void ex1() { int a; cin >> a; switch (a) { case 1: cout << "January"; break; case 2: cout << "February"; break; case 3: cout << "March"; break; case 4: cout << "April"; break; case 5: cout << "May"; break; case 6: cout << "June"; break; case 7: cout << "July"; break; case 8: cout << "August"; break; case 9: cout << "September"; break; case 10: cout << "October"; break; case 11: cout << "November"; break; case 12: cout << "December"; break; } } void ex2() { int a; cin >> a; if (a >= 160) cout << 700; else if (a >= 130) cout << 350; else if (a >= 110) cout << 150; else if (a >= 90) cout << 50; else if (a >= 70) cout << 20; else cout << 0; } void ex3() { int a, b, c; cin >> a >> b >> c; if (a < b && a < c) cout << a << " " << ((b < c) ? b : c) << " " << ((c > b) ? c : b); else if (b < a && b < c) cout << b << " " << ((a < c) ? a : c) << " " << ((c > a) ? c : a); else cout << c << " " << ((b < a) ? b : a) << " " << ((a > b) ? a : b); } void ex4() { int x1, y1, x2, y2, x, y; cin >> x1 >> y1 >> x2 >> y2 >> x >> y; // Again, this is very ugly cout << (( ((x > x1 && x < x2) || (x > x2 && x < x1)) && ((y > y1 && y < y2) || (y > y2 && y < y1)) ) ? "true" : "false"); } void ex5() { cout << "Will output 26, since = returns a reference and at the end it evaluates to c + c." << endl; int c = 5; int d = (c += 3) + (c += 5); cout << d; } void ex6() { cout << "Will output 0, = evaluates from the right to the left, so c becomes 0 and we have 0 + 0." << endl; int c = 5; if (c += c -= 5) cout << (c *= 10); else cout << c; } void ex7() { cout << "Will output nothing, since you cannot divide by 0" << endl; int c = 5; cout << ((c == 6) || (c / 0)); } void ex8() { cout << "Will output 0, since comparison is lazy and when it evaluates c == 6 as false, it just returns" << endl; int c = 5; cout << ((c == 6) && (c / 0)); } void ex9() { cout << "Will output 16 1, because = returns a reference, which is practically a number, that is more than 0 so it evaluates as true" << endl; int c = 5; double e = 0; cout << ((c = 6) && (e = 1)); cout << c << " " << e; } void ex10() { double a, b, c; cin >> a >> b >> c; // Unfinished double d = b * b - 4 * a * c; if (d < 0) { cout << "No real root." << endl; } else if (d == 0) { cout << 0; } else { d = sqrt(d); cout << (-b + d) / (2 * a) << " " << (-b - d) / 2; } } int main() { ex10(); }