回 帖 发 新 帖 刷新版面

主题:急求解答~~呜呜~~

各位大神帮帮忙,老师让编一个程序,我编了一个,可是总是: fatal error LNK1120: 1 个无法解析的外部命令,跪求解答:
#define N 200
#include<iostream>
using namespace std;
int main()
{int w,a,b,c,d,k,i,j,fa,fb,r1[199],r2[199],multi1[199],multi2[199],sum1[199],sum2[199];
cin>>a>>b>>c>>d>>w;
sum1[0]=1;sum2[0]=1;
for(j=2;j<=N;j++)
{for(k=1;k<=j-1;k++)
{for(i=1;i<=k;i++)
{fa=((i-1)/(N-1))*a+((N-i)/(N-1))*b;
 fb=(i/(N-1))*c+((N-i-1)/(N-1))*d;
 r1[i-1]=(1-w+w*fb)/(1-w+w*fa);
 r2[i-1]=((1-w+w*fb)*i)/((1-w+w*fa)*(N-i));
 if(k=1)
 {multi1[0]=r1[0];
  multi2[0]=r2[0];}
 else
 {multi1[k-1]=multi1[k-2]*r1[k-1];
  multi2[k-1]=multi2[k-2]*r2[k-1];}}
 sum1[j-2]=sum1[j-2]+multi1[k-1];
 sum2[j-2]=sum2[j-2]+multi2[k-1];}
 cout<<j<<sum1[j-2]<<sum2[j-2]<<endl;
 sum1[0]=1;sum2[0]=1;}}

回复列表 (共1个回复)

沙发


#define N 200
#include<iostream>
using namespace std;
void main()
{
        int w,a,b,c,d,k,i,j,fa,fb,r1[199],r2[199],multi1[199],multi2[199],sum1[199],sum2[199];
    cin>>a>>b>>c>>d>>w;
    sum1[0]=1;
    sum2[0]=1;
    for(j=2;j<=N;j++)
    {
        for(k=1;k<=j-1;k++)
        {
            for(i=1;i<=k;i++)
            {
                fa=((i-1)/(N-1))*a+((N-i)/(N-1))*b;
                fb=(i/(N-1))*c+((N-i-1)/(N-1))*d;
                r1[i-1]=(1-w+w*fb)/(1-w+w*fa);
                r2[i-1]=((1-w+w*fb)*i)/((1-w+w*fa)*(N-i));
                if(k==1)
                {
                    multi1[0]=r1[0];
                    multi2[0]=r2[0];
                }
                else
                {
                    multi1[k-1]=multi1[k-2]*r1[k-1];
                    multi2[k-1]=multi2[k-2]*r2[k-1];
                    sum1[j-2]=sum1[j-2]+multi1[k-1];
                    sum2[j-2]=sum2[j-2]+multi2[k-1];
                    cout<<j<<sum1[j-2]<<sum2[j-2]<<endl;
                    sum1[0]=1;sum2[0]=1;
                }
            }
        }                
    }
}
        
                    
                    
                    

我来回复

您尚未登录,请登录后再回复。点此登录或注册