include stdafx using namespace std int zel_func int int int int int in

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include "stdafx.h"
using namespace std;
int zel_func(int,int,int,int,int,int,int);
double deistv_func(double,double,double,int,int,int,int);
int _tmain()
{
double f,a,b,c;
int dx,x_beg,x_end;
cout<<"enter A,B and C"<<endl;
cin>>a>>b>>c;
cout<<"enter step (dx)"<<endl;
cin>>dx;
cout<<"enter x initial and x final"<<endl;
cin>>x_beg>>x_end;
cout<<"\xDA\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xBF"<<endl;
cout<<"\xB3"<<" x \xB3 F \xB3"<<endl;
cout<<"\xB3\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xB3\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xB3"<<endl;
if(((int)a^(int)b !=0)||((int)a^(int)b !=0))
{
for(int x=x_beg;x<=x_end;x+=dx)
{
f=deistv_func(a,b,c,dx,x_beg,x_end,x);
cout<<"\xB3"<<setw(10)<<x<<"\xB3"<<setw(10)<<"\xB3"<<endl;
}
}
else
{
for(int x=x_beg;x<=x_end;x+=dx)
{
f=zel_func(a,b,c,dx,x_beg,x_end,x);
cout<<"\xB3"<<setw(12)<<x<<"\xB3"<<setw(13)<<f<<"\xB3"<<endl;
}
}
cout<<"\xC0\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xC4\xD9"<<endl;
system("pause");
return 0;
}
int zel_func(int a,int b,int c,int dx,int x_beg,int x_end,int x)
{
int rez;
rez=(x+c<0 && a!=0)?-a*x-b:(x+c>0 && a==0)?(x-a)/(x-c):x/c+c/x;
return rez;
}
double deistv_func(double a,double b,double c,int dx,int x_beg,int x_end,int x)
{
double rez;
rez=(x+c>0 && a!=0)?-a*x-b:(x+c>0 && a==0)?(x-a)/(x-c):x/c+c/x;
return rez;
}