This commit is contained in:
Andrew 2019-11-18 10:01:42 +07:00
commit 2802401eee
79 changed files with 2650 additions and 0 deletions

View file

@ -0,0 +1,36 @@
// pb_z6_16.cpp
// Горбацевич Андрей
#include <iostream>
using namespace std;
double f(double x)
{
return 2 * x*x - 3 * x + 1;
}
void pp(double x)
{
cout.width(10);
cout.fill(' ');
cout.setf(ios_base::fixed);
cout.setf(ios_base::right);
cout << x;
cout.width(15);
cout.fill(' ');
cout.setf(ios_base::right);
cout << scientific << f(x);
cout << endl;
cout.unsetf(ios_base::scientific);
}
int main()
{
double a, b, s;
cout << "a, b, s >>>\n";
cin >> a >> b >> s;
while (a <= b)
{
pp(a);
a += s;
}
}

View file

@ -0,0 +1,44 @@
// pb_z6_17.cpp
// Горбацевич Андрей
#include <iostream>
#include <iomanip>
using namespace std;
double inline f(double x)
{
return 2 * x*x - 3 * x + 1;
}
void pp1(double x)
{
cout.width(15);
cout.fill(' ');
cout.setf(ios_base::right);
cout.setf(ios_base::fixed);
cout << setprecision(3)<<x;
}
void pp2(double x)
{
cout.width(15);
cout.fill(' ');
cout.setf(ios_base::right);
cout << scientific << setprecision(5) << f(x);
}
int main()
{
double a, b, s;
cout << "a, b, s >>>\n";
cin >> a >> b >> s;
for (double _a = a; _a <= b; _a += s)
{
pp1(_a);
}
cout << endl;
for (double _a = a; _a <= b; _a += s)
{
pp2(_a);
}
cout << endl;
}

View file

@ -0,0 +1,33 @@
// pb_z6_18.cpp
// Горбацевич Андрей
#include <iostream>
#include <cmath>
using namespace std;
double f(double);
void plot(double, double, int);
int main() {
double a, b, s;
int scale;
cout << "a, b, s, scale >>>";
cin >> a >> b >> s >> scale;
while (a < b) {
double y = f(a);
int v = (int)(y * scale);
plot(a, y, v);
a += s;
}
}
static const double PI = acos(-1);
double f(double x) {
return pow(sin(PI * x), 2);
}
void plot(double x, double y, int v) {
for (int i = 0; i < v; ++i) {
cout << " ";
}
cout << "$(" << x << ", " << y << ")" << endl;
}