473,566 Members | 2,772 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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-PartialComplete 5-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(th ick))-(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 1590
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.f iwrote:
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
14310
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? Basically: "Press any key to continue..." I beleive that I am looking for is something along the lines of a....
20
2253
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 program to figure out what was wrong in my main program. This program works fine. It compiles AND the values are correct in the output.
8
5459
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 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I...
6
2779
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 having trouble doing it all without using global variables though, so I have another post in this group about local variable usage and how to pass...
1
3698
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 attach this script files and inq files. I cant understand this error. Please suggest me. You can talk with my yahoo id b_sahoo1@yahoo.com. Now i am...
18
3114
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 how global variables and function returns work... For example, I have a global array "char datestring;" which is defined in the function speakdate....
1
6043
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. Please follow the specifications for assignment 3 as described below otherwise points will be taken off. Input from a file Please create an input...
8
2126
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 of errors in the latter, because I have memory size limitations. So, I wonder what are the best practices to know for a given program, once it is...
2
2087
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 from one base class are inherited into two derived classes. You want both derived classes to share member variables of the one base class. You...
2
10008
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 is used to access and read the value stored in it C.A variable is allocated or deallocated in memory during runtime D.A variable can be initialized...
0
7666
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7951
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1201
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.