Click here to Skip to main content
15,909,953 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Can i disable the One Page/Two Page button in the print preview window? Pin
Roger Allen16-Feb-05 1:58
Roger Allen16-Feb-05 1:58 
GeneralRe: Can i disable the One Page/Two Page button in the print preview window? Pin
AnoopVarma16-Feb-05 17:15
AnoopVarma16-Feb-05 17:15 
GeneralNagging Menu Check Problem Pin
LighthouseJ15-Feb-05 14:09
LighthouseJ15-Feb-05 14:09 
GeneralRe: Nagging Menu Check Problem Pin
Ravi Bhavnani15-Feb-05 14:44
professionalRavi Bhavnani15-Feb-05 14:44 
GeneralSteps to make a clickable area drawn by a user at run time Pin
joy00715-Feb-05 14:01
joy00715-Feb-05 14:01 
GeneralRe: Steps to make a clickable area drawn by a user at run time Pin
JWood15-Feb-05 14:56
JWood15-Feb-05 14:56 
GeneralRe: Steps to make a clickable area drawn by a user at run time Pin
Maximilien16-Feb-05 0:34
Maximilien16-Feb-05 0:34 
GeneralHelp Needed ASAP PLZ on downloading url content to file. Pin
A.Sal15-Feb-05 13:24
A.Sal15-Feb-05 13:24 
GeneralRe: Help Needed ASAP PLZ on downloading url content to file. Pin
vinnzy15-Feb-05 13:43
vinnzy15-Feb-05 13:43 
GeneralRe: Help Needed ASAP PLZ on downloading url content to file. Pin
Ravi Bhavnani15-Feb-05 15:13
professionalRavi Bhavnani15-Feb-05 15:13 
GeneralRe: Help Needed ASAP PLZ on downloading url content to file. Pin
A.Sal16-Feb-05 0:17
A.Sal16-Feb-05 0:17 
Generalhelp with the operator overloading Pin
Flydian15-Feb-05 13:16
Flydian15-Feb-05 13:16 
GeneralRe: help with the operator overloading Pin
Bob Ciora16-Feb-05 1:34
Bob Ciora16-Feb-05 1:34 
Generalproblem returning arrays Pin
aaadetos15-Feb-05 13:05
aaadetos15-Feb-05 13:05 
GeneralRe: problem returning arrays Pin
John R. Shaw15-Feb-05 13:32
John R. Shaw15-Feb-05 13:32 
GeneralRe: problem returning arrays Pin
aaadetos15-Feb-05 16:12
aaadetos15-Feb-05 16:12 
GeneralRe: problem returning arrays Pin
$8816-Feb-05 20:30
$8816-Feb-05 20:30 
GeneralRe: problem returning arrays Pin
Branislav17-Feb-05 0:19
Branislav17-Feb-05 0:19 
GeneralRe: problem returning arrays Pin
aaadetos22-Feb-05 1:27
aaadetos22-Feb-05 1:27 
GeneralRe: problem returning arrays Pin
Branislav22-Feb-05 22:56
Branislav22-Feb-05 22:56 
GeneralRe: problem returning arrays Pin
$8816-Feb-05 0:14
$8816-Feb-05 0:14 
GeneralRe: problem returning arrays Pin
Anonymous22-Feb-05 1:23
Anonymous22-Feb-05 1:23 
GeneralRe: problem returning arrays Pin
$8822-Feb-05 2:17
$8822-Feb-05 2:17 
The error is clear: You declared ei taking one parameter which is a array of double and you call it with a double value.

I don't know the rest of the code but the arrays x, a, b, expint are not usefull since you always use the value for the current index i.

Try that if you want to change them into single value


#include
#include "stdafx.h"
#include
#include
#include
using namespace std;

double a,b,expint,beta[10000],dimP2[10000];
double t[50],alpha[50],dimP[50];
int i,j;

double ei(double x)
{
double a0,a1,a2,a3,a4,a5,b1,b2,b3,b4,c1,c2,c3,c4;

a0 = -0.57721566;
a1 = 0.99999193;
a2 = -0.24991055;
a3 = 0.05519968;
a4 = -0.00976004;
a5 = 0.00107857;

b1 = 8.5733287401;
b2 = 18.059016973;
b3 = 8.6347608925;
b4 = 0.2677737343;

c1 = 9.5733223454;
c2 = 25.6329561486;
c3 = 21.0996530827;
c4 = 3.9584969228;

if (x<=0)
{
expint = -999;
}

if (x>=1)
{
a = pow(x,4)+(b1*pow(x,3))+(b2*pow(x,2))+(b3*x)+b4;
b = pow(x,4)+(c1*pow(x,3))+(c2*pow(x,2))+(c3*x)+c4;
expint = (1/(x*exp(x)))*a/b;
}

if((0 { //THIS SHALL NOT COMPILE PROPERLY Frown | :-(
expint = a0+(a1*x)+(a2*pow(x,2))+(a3*pow(x,3))+(a4*pow(x,4))+(a5*pow(x,5))-log(x);
}
return expint;
}

double time_hr()
{
double N=49.0;
for (int i=0;i<50;i++)
{
t[i] = 0.01*exp((i/N)*log(10/0.01));
}
return t[i];
}

double pD()
{
double rw = 0.25;
double ac = 43560;
double A = 80*ac;

double len_b = sqrt(0.5*A);
double len_a = 2*len_b;
double len_ri =0.5*sqrt(pow(len_a,2)+pow(len_b,2));

alpha[i] = (-(pow(rw,2)/(4*A*t[i])));

for(int i=0;i<50;i++)
{
for(int j=0;j<10000;j++)
{
dimP2[j] +=-(0.5*ei(-(1/(4*A*t[i]))*(j+1)*pow(len_ri,2)));//*
}
dimP[i]=(-0.5*ei(alpha[i]))+dimP2[j];//**
}
return dimP[i];
}





Or try that if you need to keep the intermediate arrays:

#include
#include "stdafx.h"
#include
#include
#include
using namespace std;

double a[10000],b[10000],x[10000],expint[10000],beta[10000],dimP2[10000];
double t[50],alpha[50],dimP[50];
int i,j;

double ei(double v)
{
double a0,a1,a2,a3,a4,a5,b1,b2,b3,b4,c1,c2,c3,c4;

x[i]=v;

a0 = -0.57721566;
a1 = 0.99999193;
a2 = -0.24991055;
a3 = 0.05519968;
a4 = -0.00976004;
a5 = 0.00107857;

b1 = 8.5733287401;
b2 = 18.059016973;
b3 = 8.6347608925;
b4 = 0.2677737343;

c1 = 9.5733223454;
c2 = 25.6329561486;
c3 = 21.0996530827;
c4 = 3.9584969228;

if (x[i]<=0)
{
expint[i] = -999;
}

if (x[i]>=1)
{
a[i] = pow(x[i],4)+(b1*pow(x[i],3))+(b2*pow(x[i],2))+(b3*x[i])+b4;
b[i] = pow(x[i],4)+(c1*pow(x[i],3))+(c2*pow(x[i],2))+(c3*x[i])+c4;
expint[i] = (1/(x[i]*exp(x[i])))*a[i]/b[i];
}

if((0 {
expint[i] = a0+(a1*x[i])+(a2*pow(x[i],2))+(a3*pow(x[i],3))+(a4*pow(x[i],4))+(a5*pow(x[i],5))-log(x[i]);
}
return expint[i];
}

double time_hr()
{
double N=49.0;
for (int i=0;i<50;i++)
{
t[i] = 0.01*exp((i/N)*log(10/0.01));
}
return t[i];
}

double pD()
{
double rw = 0.25;
double ac = 43560;
double A = 80*ac;

double len_b = sqrt(0.5*A);
double len_a = 2*len_b;
double len_ri =0.5*sqrt(pow(len_a,2)+pow(len_b,2));

alpha[i] = (-(pow(rw,2)/(4*A*t[i])));

for(i=0;i<50;i++) // USE THE GLOBAL i because it is used in ei function
{ // but it is certainly the j that you want ...
// sorry I can't imagine whatyou want to do !
for(int j=0;j<10000;j++)
{
dimP2[j] +=-(0.5*ei(-(1/(4*A*t[i]))*(j+1)*pow(len_ri,2)));//*
}
dimP[i]=(-0.5*ei(alpha[i]))+dimP2[j];//**
}
return dimP[i];
}



Last thing: In function pD, you should initialize the dimP2 otherwise you use it without any initialization.
for(int j=0;j<10000;j++) {
dimP2[j]=0;
}


]
GeneralPrecompiled Headers Pin
JWood15-Feb-05 12:38
JWood15-Feb-05 12:38 
GeneralRe: Precompiled Headers Pin
Selvam R15-Feb-05 22:27
professionalSelvam R15-Feb-05 22:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.