#include <iostream>
#include "second_translation_unit.h"
using namespace std;
typedef bool(*Fcn)(int);
// Прототипы функций
int moo(int x) {
return x;
}
int foo(int x, int n) {
if (x > 0)
{
int S;
S = 0;
for (int i = 1; i <= n - 1; i++)
{
int S1;
S1 = 0;
for (int j = 1; j <= n - 1; j++)
S1 += 1 / (i + j);
S += S1;
}
return S;
}
else
{
int P = 1;
for (int i = 0; i <= n - 1; i++)
for (int j = 0; j <= n - 1; j++)
{
if (i != j) P *= (x ^ 3) + 1;
else P *= 3 * x ^ 2;
}
return P;
}
}
void boo(float a, float b, float step, Fcn func) {
while (a <= b) {
cout << "(" << a << "; " << func(a) << ")" << endl;
a += step;
}
}
int main() {
setlocale(LC_ALL, "Russian");
int x, a, b, n;
float step;
cout << "Введите х" << endl;
cin >> x;
cout << "Введите n (n должно быть больше 1)" << endl;
cin >> n;
while (n < 1) {
cout << "n должно быть больше 1!";
cin >> n;
}
cout << "Введите нижний параметр а:" << endl;
cin >> a;
cout << "Введите верхний параметр b:" << endl;
cin >> b;
while (a > b)
{
cout << "Вы перепутали верхний и нижний параметры" << endl;
cout << "Введите нижний параметр а:" << endl;
cin >> a;
cout << "Введите верхний параметр b:" << endl;
cin >> b;
}
float t = 1.0;
float y = 0.9;
boo(a, b, t, foo);
boo(a, b, y, moo);
return 0;
}