hey, I got this code, but my brother needs it in terms of printf,scanf,if,for,while u know, and i uses cin,cot and those stuff... i don't remember how to write in the terms he want.. somebody can help us

this is his hw:

Calculate the value of pie from teh infinite series
pie = 4 - 4/3 + 4/5 - 4/7 + 4/9 - 4/11 +...
Print a table that shows the value of pie approximated y 1 term of this series,
by two terms, by three terms etc. How many terms of this series do you hve
to use before you first get 3.14? 3.141? 3.1415?

thanks!

Code:
#include <iostream>
using namespace std;

int main()
{
     float pi = 4, n;
     int j = 0, s = -1;
     cout << "n: ";
     cin >> n;

     cout.precision(18);
     for(float i = 3; j < n; i += 2, j++, s *= -1)
     {
          pi += (4.0F / i) * s;
          cout << j + 1 << ". " << pi << endl;
     }

     system("pause");
     return 0;
}