Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- double funcValue(const double& point) {
- return (point * point - 5.0 * point + 7.0) /
- sqrt(3.0 * point * point * point + 1.0);
- }
- int main() {
- int N;
- cout << "Etner N: ";
- cin >> N;
- if (N <= 0) {
- cout << "N must be positive";
- return 0;
- }
- int min, max;
- double temp;
- cout << "Enter values:" << endl << "1) ";
- cin >> temp;
- min = max = temp;
- for (int i = 1; i < N; i++) {
- cout << i + 1 << ") ";
- cin >> temp;
- double resonse = funcValue(temp);
- if (resonse > funcValue(max)) {
- max = temp;
- }
- if (funcValue(min) > resonse) {
- min = temp;
- }
- }
- cout << "Point with max value is " << max << endl;
- cout << "Point with min value is " << min << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement