Essays.club - Получите бесплатные рефераты, курсовые работы и научные статьи
Поиск

Лабораторная работа по "Программированию"

Автор:   •  Декабрь 26, 2020  •  Лабораторная работа  •  2,065 Слов (9 Страниц)  •  265 Просмотры

Страница 1 из 9

Лабка 1

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

    float g, x, y;

    cout << "x=";

    cin >> x;

    cout << "y=";

    cin >> y;

   

    g = (1 + cos(x + y)) * pow(x, 3) / abs(exp(x) - 2 * y) / (1 + pow(x, 2) * pow(y, 2)) + asin(y);

   

    cout << "g=" << g << endl;

}

Лабка 2

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

    int a, b, x, y;

    cout << "a="; cin >> a;

    cout << "b="; cin >> b;

    cout << "x="; cin >> x;

    if (x > 1)

    {

        y = a * pow(cos(x), 2) - b * sin(pow(x, 2));

    }

    else if (1 <= x < 4)

    {

        y = b * log10(x) + pow(x, 3);

    }

    else if (x >= 5)

    {

        y = sqrt(pow(x, 2) + a * b);

    }

    cout << "y=" << y << endl;

}

Лабка 3

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

    int x,a,b,y;

    cout << "a="; cin >> a;

    cout << "b="; cin >> b;

    cout << "x="; cin >> x;

   

    if (x > 1)

    {

        y = a * pow(cos(x), 2) - b * sin(pow(x, 2));

    }

    else if (1 <= x < 4)

    {

        y = b * log(x) + pow(x, 3);

    }

    else if (x >= 5)

    {

        y = sqrt(pow(x, 2) + a * b);

    }

    cout << "y=" << y << endl;

}

Лабка 4

№1 есеп

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

    int n=3;

    float x, x1, i=1, fak=1, y=0, s = 0, eps=0.01;

    cout << "x="; cin >> x;

    y = s = x;      

    x1 = x * x;

    while (abs(s) > eps)

    {

        fak*=(n - 1)* n;

        i *= x1;

        s = i / fak;

        y += s;

        n += 2;

    }

    cout << "y=" << y << endl;

}

№2 есеп

#include <iostream>

#include <cmath>

using namespace std;

int main()

{

    int x, x1, n = 3, i=1;

    float w, s=0, y=0, eps=0.01, t1 = 1, t2 = 1;

    cout << "x="; cin >> x;

    w = pow(x, 2) / (1 + pow(x, 2));

    x1 = w*w;

    y = s = 1;

 

    while (abs(s) < eps)

    {

        i *= x1;

        t1 *= n - 1;

        t2 *= n;

        s = t1 / t2 * i;

        y += s;

        n += 2;

    }

    cout << "y=" << y * w << endl;

...

Скачать:   txt (5.9 Kb)   pdf (82.8 Kb)   docx (16.6 Kb)  
Продолжить читать еще 8 страниц(ы) »
Доступно только на Essays.club