error "expression must be a modifiable value" ...
Calculating pi for 10,000; 20,000; 30,000 .... 100,000;
Getting the "must be a modifiable value" on the if statement where it says:
"if (i == 10,000 || i==20,000 ... etc) the 'i' is what is receiving the error
#include <iostream>
usingnamespace std;
int main ()
{
int i, num = 100000;
double pi = 0;
cout << "Find the apprx value of pi:" << endl;
for (i = 1; i <= num; i++)
{
if (i % 2 == 0)
{
pi = pi-(1.0 / (2.0 * i - 1));
}
else
{
pi = pi + (1.0 / (2.0 * i - 1));
}
if (i == 10000 || i == 20000 || i == 30000 || i == 40000 || i == 50000 || i == 60000 || i == 70000 || i == 80000 || i == 90000 || i = 100000)
{
pi = pi * 4;
cout << "For i=\n";
cout << ", the approximate value of pi is: \n";
pi = pi / 4;
}
}
system("pause");
return 0;
}