De Casteljau's algorithm to draw Bezier Curves in OOP and C++ (iterative version) #include &lt;iostream&gt;
#include "Point2d.h"
#include "Collection.h"
#include "Coordinates2d.h"
#include "graphics.h"    

#define PRECISION 0.01

Point2d Approximate(double t, Point2d const &amp; pt1, Point2d const &amp; pt2)
{
    double x = pt1.x * (1-t) + pt2.x * t;
    double y = pt1.y * (1-t) + pt2.y * t;

    return Point2d(x, y);
}

Collection&lt;Point2d&gt; GetBezierPoints(Collection&lt;Point2d&gt; const &amp; points)
{
    Collection&lt;Point2d&gt; bezierPoints;

    for(double t = 0 ; t &lt; 1 ; t = t + PRECISION)
    {
        Collection&lt;Point2d&gt; temp1 = points;

        while(temp1.size()&gt;1)
        {
            Collection&lt;Point2d&gt; temp2;

            for(int i = 0 ; i&lt;temp1.size()-1 ; i++)
            {
                Point2d pt1 = temp1[i];
                Point2d pt2 = temp1[i+1];

                temp2.Add(Approximate(t, pt1, pt2));
            }

            temp1 = temp2;
        }

        bezierPoints.Add(temp1[0]);//finally only one point will be left
    }

    return bezierPoints;
}

int main()
{
    Coordinates2d::ShowWindow("De Casteljau's algorithm");

    Collection&lt;Point2d&gt; points;

    points.Add(Point2d(0,0));
    points.Add(Point2d(80,300));    
    points.Add(Point2d(120,-150));
    points.Add(Point2d(200,0));


    Collection&lt;Point2d&gt; list = GetBezierPoints(points);

    Coordinates2d::Draw(list);

    Coordinates2d::Wait();

    return 0;
}




NOTE: I am in love with my Collection&lt;T&gt; class, which is a wrapper around std::vector.
I am repeating much of what is already in the comments but felt it should be spelled out more explicitly.

Avoid using #define statements

Per Scott Meyers's Effective C++ you should always prefer const to #define statements because #define statements are a preprocessor step, which means when you are debugging, you will see a number and not a variable name. This can make your life very difficult, so you should avoid #defines whenever possible.

Descriptive Naming

You should only use a name like temp when it's really important to emphasize that you are using a temporary variable (say to draw your reader/client's attention to the fact that a function creates a temp object and so should be used sparingly when certain memory concerns are present). Quite literally any other name would be better than temp possibly even var. Why not use pointCollection or something similarly descriptive?

Comments where helpful

I don't see any comments in your code. I am also not familiar with the libraries you are using. If you want a reader like me to understand your code, you should put in some clarification, succinct one line statements should be enough. Even for yourself, you should put in a note about what you hoped to accomplish in a function.