By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,109 Members | 1,007 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,109 IT Pros & Developers. It's quick & easy.

Problems compiling this program

P: n/a
Expand|Select|Wrap|Line Numbers
  1. #include<iostream.h>
  2. #include<conio.h>
  3. #include<math.h>
  4. #include<iomanip.h>
  5. {
  6.      double compute(double ws)
  7.      double sqrt(double r)
  8.      double main()
  9.      {
  10.         double mf,v[2],a[2],q,h[2],sv[2],z[2],r,ans2,c,ws;
  11.         double g = 9.8;
  12.  
  13.         cout<<"Device: Centrifugal compressor ";
  14.         cout<<"Mass flow rate mf (Kg/min) = ";
  15.         cin>>mf;
  16.  
  17.  
  18.             mf = mf/60;
  19.  
  20.         cout<<"Conditions at inlet: ";
  21.         cout<<"v1 (m/s) = ";
  22.         cin>>v[0];
  23.         cout<<"h1 (KJ/Kg) = ";
  24.         cin>>h[0];
  25.         cout<<"Specific volume (cubic meter/Kg) = ";
  26.         cin>>sv[0];
  27.         cout<<"Height of inlet above the ground z1 = ";
  28.         cin>>z[0];
  29.         cout<<"Condition at exit: ";
  30.         cout<<"v2 (m/s) = ";
  31.         cin>>v[1];
  32.         cout<<"h2 (KJ/Kg) = ";
  33.         cout<<"Specific volume (cubic meter/Kg) = ";
  34.         cin>>sv[1];
  35.         cout<<"Height of outlet above the ground z2 = ";
  36.         cin>>z[1];
  37.         cout<<"Heat loss to cooling water q (KJ/min) = ";
  38.         cin>>q;
  39.         cout<<"From SFEE ";
  40.  
  41.           double compute()
  42.          {
  43.          ws = -1*(mf((h[1]-h[0])+1/2(v[1]*v[1]-v[0]*v[0]+g(z[1]-z[0]))+q);
  44.          if (z[0]=z[1])
  45.          {
  46.                 g(z[1]-z[0]) = 0;
  47.          }
  48.  
  49.          cout<<"Thus the power of motor required to drive the compressor is = "<<ws<<endl;
  50.          return 0;
  51.          }
  52.  
  53.  
  54.          cout<<"Mass flow rate at inlet = Mass flow rate at outlet = "<<mf<<endl;
  55.  
  56.                 a[0] = mf*sv[0]/sv[0];
  57.                 a[1] = mf*sv[1]/sv[1];
  58.                 r = a[0]/a[1];
  59.  
  60.  
  61.  
  62.           cout<<"Thus the ratio of inlet pipe diameter to outlet pipe diameter is = "<<sqrt(double r)<<endl;
  63.  
  64.  
  65.  
  66.  
  67.  
  68.          getch();
  69.          return 0;
  70.          }
  71.  
  72.  
  73.          }
Oct 2 '10 #1
Share this Question
Share on Google+
2 Replies


Banfa
Expert Mod 5K+
P: 8,916
You will need to do more than just post your code you will need to describe the problems you're having as well as post the text of any compiler errors you are getting.

However for starters
  • The braces at lines 5 and 73 are just wrong
  • main returns int not double
  • You can not define functions inside other functions as you have done at line 41
  • You shouldn't declare sqrt at line 7, it is declared in math.h which you have included.
Oct 2 '10 #2

Expert 100+
P: 2,398
It is best if you can cut-and-paste your compiler errors into your post. These compiler error messages carry a lot of information.
Oct 3 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.