* mattyizzo@[EMAIL PROTECTED]
> Here is my code. Basically I'm trying to solve for CI and CF, where
> each use a bunch of constants and a variable or two which can have up
> to 10 values. I get the following error, however, at line 39:
>
> 39 H:\Project 2-PartialComplete5-7.cpp invalid operands of types
> `double ()(double)' and `const double' to binary `operator/'
>
> The error itself is at the equation starting with dQ = ... Any ideas,
> suggestions?
> Here is my code:
>
> // Project 2
>
> #include <iostream>
> #include <stdlib.h>
> #include <iomanip>
> #include <cmath>
> #include <math.h>
> using namespace std;
>
> const double a = 0.05; // Constants Declared
> const double L = 100; // Constants Declared
> const double Ta = 150; // Constants Declared
> const double k = 0.1; // Constants Declared
> const double F = 3.0; // Constants Declared
> const double Cvol = 325; // Constants Declared
> const double CL = 1.50; // Constants Declared
> const double CstHeat = 0.00000000111; // Constants Declared
>
> double b(double thick); // Function Declaration
Here you declare b as a function.
> double CI(double thick); // Function Declaration
> double CF(double thick, double Tair); // Function Declaration
>
> double b(double thick) // Function 'b' Starts
> {
> return (a+thick);
> }
>
> double CI(double thick) // Function 'CI' Starts
> {
> return ((b(thick)*b(thick))-(a*a))*L*Cvol + (L+CL);
> }
>
> double CF(double thick, double Tair) // Function 'CF' Starts
> {
> double Q3;
> double dQ;
>
> Q3 = 2*3.14*a*F*(Ta-Tair)*L;
> dQ = Q3*(1-((b/a)/(1+((b*F)/k*(log(b/a))))));
Here you try to divide the function b by a.
> return dQ*(157800000)*(CstHeat);
> }
>
> int main () // Main Function Start
> {
> double thick; // Variables Declared
> double Tair; // Variables Declared
>
> double b(double thick); // Call Function
> double CI(double thick); // Call Function
> double Q3(double Tair); // Call Function
As a general rule, don't declare functions inside other functions.
>
> for (thick = 1.0; thick <=10.0; thick +=1.0) // for loop
> {
> cout << CI(thick) << endl;
> }
>
> for (Tair = -10; Tair <=10; Tair +=10)
> {
> cout << Q3(Tair) << endl;
> }
>
> system ("pause");
> }
Cheers, & hth.,
- Alf
--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?


|