1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#include <iostream>
using namespace std;
int main()
{
float A[][3] = { {7./15, 7./15, 1./15}, {7./15, 1./15, 1./15}, {1./15, 7./15, 13./15} }
, r[] = {1/3, 1/3, 1/3}, sum[3]={0};
while( (sum[0]!= r[0]) || (sum[1] != r[1]) ||(sum[2]!= r[2]) )
{
for(int row = 0;row <3;++row)
for(int i =0;i<3;++i)
sum[i] += A[row][i] * r[i];
sum[0]=r[0];
sum[1]=r[1];
sum[2]=r[2];
}
cout << r[0] << ',' <<r[1] << ',' <<r[2];
for(;;);
return 0;
}
|