15
#include <iostream>
#include <clocale>
#include "math.h"
using namespace std;
void majorF(float, float, float, float, float, float);
float firstF(float, float, float);
float secondF(float, float);
float thirdF(float, float);
float resultF(float, float, float, float);
int main() {
setlocale(LC_ALL, "Russian");
float xn, dx, xe, a, b, c;
cout << "Введите начало отрезка, шаг по отрезку и его конец: " << endl;
cin >> xn >> dx >> xe;
cout << "Введите a,b и c: " << endl;
cin >> a >> b >> c;
majorF(xn, dx, xe, a, b, c);
return 0;
}
void majorF(float xn, float dx, float xe, float a, float b, float c) {
float F;
for (float i = xn; i < xe; i += dx) {
if (i < 5 && c != 0)
F = firstF(i, a, b);
else if (i > 5 && c == 0)
F = secondF(i, a);
else if (c != 0)
F = thirdF(i, c);
resultF(F, a, b, c);
}
}
float firstF(float x, float a, float b) {
float f = -a*(x*x) - b;
return f;
}
float secondF(float x, float a) {
float f = (x - a) / x;
return f;
}
float thirdF(float x, float c) {
float f = -x / c;
return f;
}
float resultF(float F, float a, float b, float c) {
int a1 = (int)a;
int b1 = (int)b;
int c1 = (int)c;
float f;
if (((a1 | b1) ^ (a1 | c1)) == 0)
f = (int)F;
else f = F;
return f;
}