473,382 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Help with program using multiple functions/variables

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");
}
Jun 27 '08 #1
3 1578
Ok, so my problem was that I created a function 'b' in which I
returned the value of b (which in this program, is 'thick' + 'a'.

So instead of using the function within the CF function, I replaced
'b' with 'a+thick'.

My next problem is I have to print out a table of the CI function, the
CF function, and then somehow a table that shows CF-CI (but the
problem here is that CI has 10 values, and CF has 3...
Jun 27 '08 #2
mattyi...@gmail.com kirjoitti:
const double a = 0.05; // Constants Declared
double b(double thick); // Function Declaration
double b(double thick) // Function 'b' Starts
double thick; // Variables Declared
double b(double thick); // Call Function
Slightly off-topic, but I really love your comments.
Jun 27 '08 #3
On May 8, 6:41 am, Krice <pau...@mbnet.fiwrote:
mattyi...@gmail.com kirjoitti:
const double a = 0.05; // Constants Declared
double b(double thick); // Function Declaration
double b(double thick) // Function 'b' Starts
double thick; // Variables Declared
double b(double thick); // Call Function

Slightly off-topic, but I really love your comments.
Hahaha, are they not clear enough? I'm a beginner at this stuff, and
my project is due within 3 hours. Sucks to be a n00b.
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

31
by: da Vinci | last post by:
OK, this has got to be a simple one and yet I cannot find the answer in my textbook. How can I get a simple pause after an output line, that simply waits for any key to be pressed to move on? ...
20
by: da Vinci | last post by:
Hello again. I have a question regaring pass-by-reference and multiple functions. This is an assignment that I have to use pass-by-reference for everything. First off, I made the following...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
6
by: tigrfire | last post by:
I've been working on a program to try and play a game of Craps, based on a version I found elsewhere - I didn't code the original, but I added a few things such as a balance and wager system. I'm...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
18
by: ben.carbery | last post by:
Hi, I have just written a simple program to get me started in C that calculates the number of days since your birthdate. One thing that confuses me about the program (even though it works) is...
1
by: al2004 | last post by:
Write a program that reads information about youth soccer teams from a file, calculates the average score for each team and prints the averages in a neatly formatted table along with the team name....
8
by: Horacius ReX | last post by:
Hi, I am developing some code in C which first I compile on my linux machine and afterwards I test on another special hardware which has almost no debug capabilities at all. Usually I get a lot...
2
by: Immortal Nephi | last post by:
You may have heard diamond shape. You create one base class. One base class has member functions and member variables. You create two derived classes. All member functions and member variables...
2
by: hcaptech | last post by:
This is my Test.can you help me ? 1.Which of the following statement about C# varialble is incorrect ? A.A variable is a computer memory location identified by a unique name B.A variable's name...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.