DimaEdition cpp определяет точку входа для консольного приложения incl

 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
55
56
// DimaEdition.cpp: определяет точку входа для консольного приложения.
//
#include "stdafx.h"
using namespace std;
void f1(double a, double b, double x1, double x2, double Xd);
void f2(double a, double c, double x1, double x2, double Xd);
void f3(double a, double b, double c, double x1, double x2, double Xd);
void f1(double a, double b, double x1, double x2, double Xd)
{
while (x1 <= x2)
{
cout << "\t" << x1 << "\t\t" << (a*x1*x1 + b*b*x1) << endl;
x1 += Xd;
}
}
void f2(double a, double c, double x1, double x2, double Xd)
{
while (x1 <= x2)
{
cout << "\t" << x1 << "\t\t" << (x1 + a) / (x1 + c) << endl;
x1 += Xd;
}
}
void f3(double a, double b, double c, double x1, double x2, double Xd)
{
while (x1 <= x2)
{
cout << "\t" << x1 << "\t\t" << (a*x1) / (c*b*b) << endl;
x1 += Xd;
}
}
int _tmain(int argc, _TCHAR* argv[])
{
double a, b, c, Xd, x1, x2;
cout << "Enter a, b and c\n";
cin >> a >> b >> c;
cout << "Enter x1, x2 and Xd\n";
cin >> x1 >> x2 >> Xd;
cout << "---------------------------------\nI x I F I\n---------------------------------\n";
if (c < 0 && b != 0)
f1(a, b, x1, x2, Xd);
else if (c > 0 && b == 0)
f2(a, c, x1, x2, Xd);
else
f3(a, b, c, x1, x2, Xd);
cout << "---------------------------------\n";
return 0;
}