Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C++ by Shirma ( 16 years ago )
#include <iostream>
#include <cmath>
#include <iomanip>
#include <clocale>
using namespace std;
double func(double a, double b, double c, double x)
{
double f;
int ac, bc, cc;
if (x<0.6 && b+c!=0) f=a*pow(x,3)+pow(b,2)+c;
if (x>0.6 && b+c==0) f=(x-a)/(x-c);
else f=x/c+x/a;
ac=(int)a;
bc=(int)b;
cc=(int)c;
if (ac|bc&cc;!=0) f=(double)f;
else f=(int)f;
return f;
}
int main()
{
double a,b,c,f,x,xn,xk,dx;
setlocale(LC_ALL,"rus");
cout<<"Введите a"<<endl;
cin>>a;
cout<<"Введите b"<<endl;
cin>>b;
cout<<"Введите c"<<endl;
cin>>c;
cout<<"Введите начальное х"<<endl;
cin>>xn;
cout<<"Введите конечное х"<<endl;
cin>>xk;
cout<<"Введите шаг"<<endl;
cin>>dx;
cout<<endl;
cout<<setw(4)<<"f"<<setw(4)<<"x"<<endl;
for(x=xn;x<=xk;x=x+dx)
{
f=func(a,b,c,x);
cout<<setw(4)<<setprecision(3)<<f<<setw(4)<<setprecision(3)<<x<<endl;
}
return 0;
}
Revise this Paste