Talk About Network



Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Help with progr...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 45802 of 45898
Post > Topic >>

Help with program using multiple functions/variables

by mattyizzo@[EMAIL PROTECTED] May 7, 2008 at 06:02 PM

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
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))))));
       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

    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");
}




 5 Posts in Topic:
Help with program using multiple functions/variables
mattyizzo@[EMAIL PROTECTE  2008-05-07 18:02:10 
Re: Help with program using multiple functions/variables
"Alf P. Steinbach&qu  2008-05-08 03:10:38 
Re: Help with program using multiple functions/variables
mattyizzo@[EMAIL PROTECTE  2008-05-07 18:26:19 
Re: Help with program using multiple functions/variables
Krice <paulkp@[EMAIL P  2008-05-08 03:41:28 
Re: Help with program using multiple functions/variables
mattyizzo@[EMAIL PROTECTE  2008-05-08 06:14:01 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue May 13 14:44:11 CDT 2008.