1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| #include <iostream>
using namespace std;
int pow(int n, int e)
{
if (e==0)
return 1;
else
return n*pow(n,e-1);
}
int main()
{
float Ri=5000;
float iRi=1.0/Ri;
float Rk[14]={5.7,11,15,22,46,46,93,138,265,480,1010,2000,3003,4007};
float iRk[14];
for (int i=0;i<14;i++)
iRk[i]=1.0/Rk[i];
for (int indice=0;indice<16384;indice++)
{
float Re, iRe=0;
for (int resistance=0;resistance<14;resistance++)
if ((indice/pow(2,resistance))%2==1)
iRe += iRk[resistance];
Re=1.0/iRe;
cout<< indice<<" "<<Re<<endl;
}
cout<<"Fin\n";
return 0;
} |
Partager