I am having trouble getting my program to run. I can't figure out where this error is...prob. something easy and i'm just to tired to find it. Anyways here is the project details and the c++ code that I have wrote is attached below since I haven't messed with the code wrap yet. If there are any suggestions on how I can make the program easier pls tell me your 2 cents.

error: 56: ) expected in function main()
I counted and couldn't find where i left a ")" off if someone would show me another way to write the formula into an easier to handle form it would be greatly appreciated as well.

Program #4

The equation of state for carbon dioxide is given by Reynolds as
****formula in word attachment*******

where ρ is the density in kg/m^3, P is the pressure in Pa, T is the temperature in K, and the constants are given below:
A1=2.2488558×10^-1 A11=1.2115286×10^-10
A2=−1.3717965×10^2 A12=1.0783386×10^-7
A3=−1.4430214×10^4 A13=4.3962336×10^-11
A4=−2.9630491×10^6 A14=−3.6505545×10^4
A5=−2.0606039×10^8 A15=1.9490511×10^7
A6=4.5554393×10^-5 A16=−2.9186718×10^9
A7=7.7042840×10^-2 A17=2.4358627×10^-2
A8=4.0602371×10^1 A18=−3.7546530×10^1
A9=4.0029509×10^-7 A19=1.1898141×10^4
A10=−3.9436077×10^-4 γ=5.0×10^-6

Write a C++ function that will calculate the pressure of superheated carbon dioxide given the density and temperature. Also write a driver program that will illustrate the use of the function for the following data points:
Case # Density (kg/m^3) Temperature (K)
1 18.5908 300
2 50.0 500
3 50.0 700
4 50.0 900

#include <iostream>
#include <enmvec.h>
using namespace std;
using namespace ENM;
int main(void)

	double density, temp, R, y, caseNumber;
	double a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14;
	double a15, a16, a17, a18, a19 ;

 cout << "Enter the Case #" << endl;
	cin >> caseNumber ;
	cout << endl;

	cout << "Enter the temperature:" << endl;
   cin >> temp ;
	cout << endl;

	cout << "Enter the density:" << endl;
	cin >> density ;
   cout << endl;

	a1 = 2.2488558e-1 ;
   a2 = -1.3717965e2 ;
	a3 = -1.4430214e4 ; 
	a4 = -2.9630491e6 ;
	a5 = -2.0606039e8 ;
	a6 = 4.5554393e-5 ;
	a7 = 7.7042840e-2 ;
	a8 = 4.0602371e1 ;
	a9 = 4.0029509e-7 ;
	a10 = -3.9436077e-4 ;
	a11 = 1.2115286e-10 ;
	a12 = 1.0783386e-7 ;
	a13 = 4.3962336e-11 ;
	a14 = -3.6505545e4 ;
	a15 = 1.9490511e7 ;
	a16 = -2.9186718e9 ;
	a17 = 2.4358627e-2 ;
	a18 = -3.7546530e1 ;
	a19 = 1.1898141e4 ;
	R = 188.918 ;
	y = 5.0e-6 ;

	double pressure = density*R*temp+pow(density,2)*(a1*pow(temp,(2-1))

	cout << " For case #" << caseNumber << "with the given temperature of " << temp << "K" ;
   cout << "and a density of " << density << "kg/m^3" << "the pressure of the co2 system is " ;
   cout << pressure << "Pa" << endl;

6 Years
Discussion Span
Last Post by wisaacs

As far as I can tell, in "(a14*pow(temp,(12-14))" the ( is unclosed.
It's on the 5th line in your big calculation.

It would help if you format this big calculation a little.. it doesn't matter if there are spaces or tabs around math operations... that way it would be much easier to spot the problem.

Also... you forgot the ; after the big calculation.


My system can't read the Word attachment.
Word .doc files are virus vectors.
You might want to post the math doc in hypertext.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.