Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
619 B
0
Indexable
Never
#include <iostream>
#include <fstream>
using namespace std;

// Задача 1
double v(double a, double b, double h)
{
    return 1.0 / 3 * a * a * h;
}
// Задача 2
double l(double a, double b)
{
    return 4 * (3.141 * a * b + ((a - b) * (a - b)) / (a + b));
}

int main()
{
    // Задача 1
    ifstream in("input.txt");
    int a, b, h;
    in >> a >> b >> h;

    cout << v(a, b, h);

    // Задача 2
    ifstream in("Oval.txt");
    int n, a, b;
    in >> n;
    for (int i = 0; i < n; i++)
    {
        in >> a >> b;
        cout << l(a, b) << endl;
    }
}