...Seeing the Report button pressed... |
I don't think I have offended anyone in any way.
burnout1974 wrote: |
---|
EssGeEich not sure who you aiming at in your comment |
I'm sure you know who my comment was aiming at - Otherwise you didn't assume I was talking to you - And there's no one else besides me, you and AbstractionAnon on this topic.
burnout1974 wrote: |
---|
I was asking for help everything I posted was my work as wrong as it may have been. |
We are not mind readers. Anyways, even after AbstractionAnon gave you (for the third time) the right answer, you rudely doubleposted the code and the errors, this time leaving away your "I can't compile this" comment.
burnout1974 wrote: |
---|
I am just trying to get some help and understand a little better. |
If this last statement was true, then you should have also written something like "Do you know what happened, so I can avoid these problems later?".
burnout1974 wrote: |
---|
So you have a nice day and if you see anything else I post kindly keep going. |
Just because you tought my intention was to flame this doesn't mean I cannot be of any help to you - Also because I recognized what the problem was and what the solution was - Even after reading the answer.
Making you notice again we're not paid, we don't pay and neither do you - This is a volunteer thing. The answers come from people who want to give an answer.
Giving you a proof I can be of help to you, and quoting AbstractionAnon:
AbstractionAnon wrote: |
---|
Your forward declarations and your implementation do not agree |
You may not know what a Forward Declaration/Implementation is, Yeah?
Well, Just by reading at your comments I know you DO know something about those:
1 2 3 4 5 6 7
|
// funtion prototypes
int getTreeNo();
int getSpeciesCode();
float getDbh();
int getTotHt();
float calTotVol(double b0, double b1, float dbh, int totalHt);
|
These are the Forward Declarations, also called Prototypes as you commented over them.
1 2 3 4 5 6 7 8 9 10
|
int getTotHt()
{
int totalHt;
cout<< "Please enter the total height of the tree."<<endl;
cout<<"The value must be between 24 qnd 160."<<endl;
cin>> totalHt;
if (totalHt < 24 || totalHt > 160)
cout<<"Please enter a value within the parameters."<<endl;
return totalHt;
}
|
This is getTotHt's implementation.
The errors are about calTotVol and getTreeNo.
Let's see their Prototypes and Implementations, beginning with calTotVol:
1 2 3 4 5 6 7 8 9
|
//calTotVol's prototype
float calTotVol(double b0, double b1, float dbh, int totalHt);
// its Implementation
float calTotVol(double b0[6], double b1[6], float dbh, int totalHt)
{
float totalVol;
totalVol = (b0[6] + b1[6]) * pow(dbh,2) * (totalHt);
return totalVol;
}
|
You see what's different? In your prototype you use
double b0, double b1
where in your implementation you use
double b0[6], double b1[6]
. That's all. Anyways you will have a logic/bad memory access error.
But I'll let you figure that out by yourself unless you re-post asking why the results are completely wrong or why the memory you are accessing is bad.
About getTreeNo:
1 2 3 4
|
// Prototype:
int getTreeNo(void);
// Implementation:
int getTreeNo(int) { /*...*/ }
|
You see their difference? You are using an int right there you should substitute with a void - Even because you're not using that parameter.
Have fun, "Big Yo".