I'm trying to code a program that compares multiple values of two variables (CI and CF). CI contains one variable that can have 1 of 10 values, and CF contains variables which must be solved themselves (and one of these containing a variable that can have 1 of 3 values). After all the computing is said and done, I need to subtract CI from CF and output the values of CI, CF and CF-CI into three tables. I have included the code below. Note that all constants are listed, and the two variables that can have multiple values are 'thick' (1-10) and 'Tair' (-10, 0, 10). Also note that 'thick' + 'a' is actually variable 'b'. My problem is that 'b' and 'Tair' are found in a few equations, that will most likely be buried in functions. Code-wise, I've got it to a point, but to do what from here is where I'm stuck. Any help or suggestions are much appreciated.
// 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 Q3(double Tair); // Function Declaration
double dQ(double Q3); // 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 Q3(double Tair) // Function 'Q3' Starts
{
return (2*3.14*a*F*(Ta - Tair)*L);
}
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");
}