Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ВАРИАНТ 26
- //
- #include <iostream>
- #include <stdio.h>
- #include <math.h>
- using namespace std;
- double getFunctionResult(double x, double a) {
- return (2 * x / (sqrt(0.2 * a + cos(x / 2 + a))));
- }
- int main() {
- setlocale(LC_ALL, "Russian");
- char arr[] = "ОШИБКА!";
- const double X = -0.9, XX = 4.1, XXX = 0.5;
- double a, x;
- int L = (XX - X) / XXX;
- x = X;
- cout << "ВВЕДИТЕ A: \n ";
- cin >> a;
- printf("-----------------------------------------------------------\n");
- printf(" | A | FUNCTION | X |\n");
- printf("-----------------------------------------------------------\n");
- for (int k = 0; k < L; k = k + 1) {
- while (x != XX) {
- if (2 * x / (sqrt(0.2 * a + cos(x / 2 + a))) == 0) {
- printf("| %6.2f | %25.2s | %17.5s |\n", a, x, arr);
- } else {
- printf("| %6.2f | %25.2f | %17.5f |\n", a, x, getFunctionResult(x, a));
- }
- x = x + XXX;
- }
- }
- printf("-----------------------------------------------------------\n");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement