DevC ++ returns "source file not compiled". Because?

1

I can compile the file quietly, but when I run it it presents the source file not compiled. Could anyone help me?

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>

int main ()
{
    float a, b, c, y;
    printf("\nDigite os valores de a,b e c: ");
    scanf("%f %f %f", &a, &b, &c);
    while (a>b);
    if (b>c)
        y=(a+b*c);
    else
        y=(a+c*b);
    printf("o valor do Y e: ", y);
    while(a<b);
    if (a>c)
        y=(a+b*b);
    else
        y=(b+c*a);
    printf("o valor do Y e: ", y);
    system("PAUSE");
}
    
asked by anonymous 28.05.2014 / 16:40

1 answer

3

Dev-C ++ is an obsolete IDE and so I do not recommend using it because of several design bugs that occur.

If you really like Dev-C ++, I suggest you install wxDev-C ++ because it is software that continues to be developed or the < a code="http://www.codeblocks.org/"> Code :: Blocks

As for your code there are several things that should be highlighted:

You do not even need #include <stdlib.h> (although you used the system function that is present in it) it is worth noting that it is not a good practice to call system functions. And everything that used the system was to wait after the program closes, for this type of case, I suggest you use only scanf() .

The #include <conio.h> library is not called at all in this code and I do not recommend using it for portability. Generally I see use the getch () of conio.h for the same purpose that used SYSTEM ("PAUSE") and both are unnecessary mainly because the scanf of stdio.h has the same effect and you are already using it.

while (a>b); this while everything goes wrong, you run a loop without doing any interaction. Even if one of the items in this loop were y (which you change later) this loop would still be infinite because after the while condition you use ; . To place elements inside a loop you need to use the keys { } .

printf will not show the variable unless you specify where it should be shown in the string format.

Here is an example of what I believe I was trying to do with this code:

#include <stdio.h>

int main ()
{
    float a, b, c, y;
    printf("\nDigite os valores de a,b e c: ");
    scanf("%f %f %f", &a, &b, &c);
    while (a>y){
        if (b>c)
            y=(a+b*c);
        else
            y=(a+c*b);
        printf("o valor do Y e: %f", y);
    }

    while(y<b){
        if (a>c)
            y=(a+b*b);
        else
            y=(b+c*a);
    }
    printf("o valor do Y e: %f", y);
    scanf("",&a);
    return 0; // return EXIT_SUCCESS;
}
    
29.05.2014 / 02:38