I just created a program for my course in school to calculate pressure loss in piping. No errors were found but when i executed the file, it said this word for word.
*** Process returned -1 ***
press any key to continue...
then it just exits.
anyone know what might be my problem?
I suggest you post some code that replicates the problem.
John
#include <stdio.h>
#include <math.h>
int main(void)
{
double pd; // pressure drop in pounds per square inch (psi) / foot of pipe
double f; // flow in gallons per minute
double d; // inside pipe diameter (inches)
int c_factor; // factor (roughness or friction loss coefficient)
int type; // type of piping
int age; // age of cast-iron piping
printf ("Welcome To The Pressure Drop Calculator\n");
printf ("1. Cast Iron\n"); // C Factor Varies
printf ("2. Concrete\n"); // C Factor is 100
printf ("3. Copper\n"); // C Factor of 150
printf ("4. Steel \n"); // C Factor of 120
printf ("5. PVC (polyvinyl chloride\n"); // C Factor of 150
printf ("6. Other\n"); //C Factor Is Given By User
printf ("Please enter type of pipe according to numbers above:");
scanf ("%d", &type);
// switch to find out the type of pipe the user selected
switch (type)
{
case 1:
printf ("What is the age of the cast-iron pipe\n");
scanf ("%d", &age);
// If statement to find out C Factor related to the age of cast-iron pipe
if ( 0 <= age && age < 10 )
c_factor = 130;
if ( 10 <= age && age < 20 )
c_factor = 110;
if ( 20 <= age && age < 30 )
c_factor = 95;
if ( 30 <= age && age < 40 )
c_factor = 83;
else c_factor = 70;
break;
case 2:
c_factor = 100;
break;
case 3:
c_factor = 150;
break;
case 4:
c_factor = 120;
break;
case 5:
c_factor = 150;
break;
case 6:
printf ("Please enter the C factor of the pipe\n");
scanf ("%d", &c_factor);
while (c_factor <= 0)
{
printf ("Please enter a friction coefficient bigger than zero\n");
scanf ("%d", &c_factor);
printf ("\n");
}
break;
default : printf ("unknown pipe type %d\n", type);
}
printf ("The C Factor of the pipe is: %d", c_factor);
printf ("\n");
printf ("Please enter the diameter of the pipe:");
scanf ("%lf", &d);
printf ("\n");
// protection from dividing by zero and negative numbers
while (d <= 0)
printf ("Please enter a diameter greater than zero");
scanf ("%lf", &d);
printf ("\n");
printf ("To conclude, please enter the gallons per minute");
scanf ("%lf", &f);
printf ("\n\n");
// Calculation to find out pressure drop
pd = (4.52 * pow ( f, 1.85 ) ) / (pow ( c_factor, 1.85 ) * pow ( d, 4.87 ) );
printf ("The pressure drop is: %.4lf", pd);
printf ("\n\n");
return 0;
}
I do not get
*** Process returned -1 ***
the code seems to conclude without a problem.
What values are you entering?
John
I cant enter any values. the moment i press any key, it exits. And im using Pelles C on vista.
Quote from: baranmat90 on October 13, 2008, 05:17:46 PM
I cant enter any values. the moment i press any key, it exits. And im using Pelles C on vista.
You should have said straight off.
Anyway, I run XP and have no problems here.
Maybe someone using vista can try.
John
Other than having to insert the missing braces after the
while (d <= 0)
I have no problem compiling and running Pelle's 64 bit 5.01 compiled x86 and x64 executables on Vista x64.
Robert Wishlaw
Any chance that you're running the 32-bit version on 64-bit Vista? Some programs will run, many (most?) of them won't in this situation. Trust me, I speak from experience ... :-[
Be sure you're using the 64-bit version of Pelles C if you're using 64-bit Vista.
Tom