//max #include using namespace std; float(float a, float b, float c) { if (a>b) } //liniowamz #include using namespace std; float mz(float a, float b) { return (-b) / a; } int main() { cout << "Podaj a: "; static float a; cin >> a; cin.get(); cout << "Podaj b: "; static float b; cin >> b; cin.get(); float foo = mz(a, b); cout << "Miejsce zerowe funkcji f(x)=" << a << "x+(" << b << ") to punkt: (" << foo << ", 0)" << endl; cin.get(); return 0; } //delta #include using namespace std; struct mz { double x1; double x2; bool no_solution = 0; }; mz obl_mz(double a, double b, double c) { mz result{}; double delta = ((b*b) - (4*a*c)); if (delta < 0) { result.no_solution = 1; } else if (delta > 0) { result.x1 = ((-b) - sqrt(delta)) / (2 * a); result.x2 = ((-b) + sqrt(delta)) / (2 * a); } else { result.x1 = result.x2 = (-b) / (2 * a); } return result; } int main() { cout << "OBLICZANIE MIEJSC ZEROWYCH FUNKCJI KWADRATOWEJ" << endl; cout << "----------------------------------------------" << endl; cout << "Poda a: "; double a; cin >> a; cin.get(); cout << "Poda b: "; double b; cin >> b; cin.get(); cout << "Poda c: "; double c; cin >> c; cin.get(); mz wynik = obl_mz(a, b, c); if (wynik.no_solution == 1) { cout << "Brak miejsc zerowych w przestrzeni liczb rzeczywistych" << endl; } else if (abs(wynik.x1 - wynik.x2) < 0.000000000001) { cout << "x=" << wynik.x1; } else { cout << "x1=" << wynik.x1 << ", x2=" << wynik.x2 << endl; } cin.get(); return 0; } //fib #include using namespace std; unsigned long fib_r(const unsigned int n) { if (n < 1) return 0; else if (n == 1 || n == 2) return 1; else return (fib_r(n - 1) + fib_r(n - 2)); } int main() { cout << "Ktory wyraz ciagu Fibonacciego obliczyc: "; unsigned int n; cin >> n; cin.get(); cout << "#" << n << " wyraz to: " << fib_r(n) << endl; cin.get(); }