NO

Author Topic: Process returned -1 ????  (Read 5992 times)

baranmat90

  • Guest
Process returned -1 ????
« on: October 13, 2008, 12:01:39 AM »
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?

JohnF

  • Guest
Re: Process returned -1 ????
« Reply #1 on: October 13, 2008, 09:03:17 AM »
I suggest you post some code that replicates the problem.

John

baranmat90

  • Guest
Re: Process returned -1 ????
« Reply #2 on: October 13, 2008, 04:25:13 PM »
#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;
}   

JohnF

  • Guest
Re: Process returned -1 ????
« Reply #3 on: October 13, 2008, 05:11:51 PM »
I do not get

*** Process returned -1 ***

the code seems to conclude without a problem.

What values are you entering?

John
« Last Edit: October 13, 2008, 05:14:41 PM by JohnF »

baranmat90

  • Guest
Re: Process returned -1 ????
« Reply #4 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.

JohnF

  • Guest
Re: Process returned -1 ????
« Reply #5 on: October 13, 2008, 06:04:05 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

Offline Robert

  • Member
  • *
  • Posts: 245
Re: Process returned -1 ????
« Reply #6 on: October 14, 2008, 01:05:34 AM »
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

tbohon

  • Guest
Re: Process returned -1 ????
« Reply #7 on: October 15, 2008, 06:15:47 PM »
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