ясно
2) вот одна версия
Код:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float x, y, a, b;
cout << "write x=";
cin >> x;
cout << "write a=";
cin >> a;
if(x>a)
{
y = a*pow(x, 3);
}
else if(x<a)
{
cout << "write b=";
cin >> b;
y = pow(a*pow(x, 3)+b, 2);
}
else
{
if(x>0)
{
cout << "write b=";
cin >> b;
y=a*b/sqrt(x)+b;
}
else
{
cout << endl << "Wrong x. x have to be > 0" << endl;
return 1;
}
}
cout << endl << "y=" << y << endl;
return 0;
}
а вот вторая)) версия
Код:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float x, y, a, b;
cout << "write x=";
cin >> x;
cout << "write a=";
cin >> a;
if(x>a)
{
y = a*pow(x, 3);
}
else if(x<a)
{
cout << "write b=";
cin >> b;
y = pow(a*pow(x, 3)+b, 2);
}
else
{
cout << "write b=";
cin >> b;
if(x>0)
{
y=a*b/sqrt(x)+b;
}
else if(x<0)
{
y=a*b/sqrt(abs(x));
cout << y <<"*i + " << b << endl;
return 0;
}
else
{
cout << "Infinity";
return 0;
}
}
cout << endl << "y=" << y << endl;
return 0;
}