Newer
Older
Lecture_repo / Lectures_my / NumMet / Lecture3 / examples / ex1.cc
@Danny van Dyk Danny van Dyk on 19 Sep 2016 332 bytes add preliminary lecture 3
/* vim: set sw=4 sts=4 et foldmethod=syntax : */

#include <cmath>
#include <iostream>

double f(const double & h)
{
    return std::sin(h) / h;
}

int main(int, char **)
{
    for (unsigned i = 0 ; i < 5 ; ++i)
    {
        double h = std::pow(0.5, i);

        std::cout << h << "\t" << f(h) << std::endl;
    }

    return 0;
}