Untitled

 avatar
unknown
c_cpp
a year ago
525 B
4
Indexable
#include <fstream>
#include <iostream>

double calculateArea( int a, int b, int h )
{
    return static_cast< double >( ( a + b ) ) * h * 0.5;
}

int main()
{
    std::ifstream inputFile( "dane.txt" );

    int a, b, h;

    if( inputFile.is_open() )
    {
        inputFile >> a >> b >> h;
        inputFile.close();
    }
    else
    {
        std::cout << "Nie mozna otworzyc pliku dane.txt\n";
        return -1;
    }

    std::cout << a << '\n' << b << '\n' << h << '\n';

    return 0;
}
Editor is loading...
Leave a Comment