Need help for simple program, don't have a clue about C.

Please, can you help me? I have 3 errors
- Undefined symbol i
- Undefined symbol y and
- Compound statement missing

See the program bellow:

#include<stdio.h>
#include<conio.h>
#include <math.h>
void main( )
{
float a, b, c,x3;
float a0,a1,a2;
clrscr( );
printf("Raiz: x = a + bi ");
printf("Digite o valor de a: ");
scanf("%f",&a);
printf("Digite o valor de b: ");
scanf("%f",&b);
printf("Digite o valor de x3: ");
scanf("%f",&x3);
printf("As raizes sao: ");
printf("x1 = %.2f + %.2f i \n",a,b);
printf("x2 = %.2f - %.2f i \n ",a,b);
printf("x3 = %.2f \n",x3);
a0=-(a*a+b*b)*x3;
a1=(a*a+b*b)+x3*2*a;
a2=-(2*a+x3);
printf("a0= %f a1=%f a2=%f \n\n",a0,a1,a2);
printf("Polinomio y = x3 + %.2fxý + %.2fx + %.2f \n",a2,a1,a0);
//Oráculo para verificar a situação de cada ponto se IN, OUT, ON
for(i=-20;i<=20;i++)
{
y= (i*i*i) + (a2*i*i) + (a1*i) + a0;
if(y<-20)
printf(" x = %i \t y = %.2f OUT\n",i,y);
if(y==-20)
printf(" x = %i \t y = %.2f ON\n",i,y);
if(y>-20 && y<20)
printf(" x = %i \t y = %.2f IN\n",i,y);
if(y==20)
printf(" x = %i \t y = %.2f ON\n",i,y);
if(y>20)
printf(" x = %i \t y = %.2f OUT\n",i,y);
getch( );
}
Narue commented: Fail. -4
Nick Evan commented: gah.. -2

Recommended Answers

All 2 Replies

thank you for dropping your load of crap in a 5 year old thread that was already resolved and put to bed.

The next time you wish to drop another load, let me suggest that you start a new thread all on your own. That way you won't soil someone else's thread, you won't confuse other students else with your broken, non-portable junk, and we can tell you why your code is crap.

meanwhile: request thread closed.

compile errors include:
-- void(main), main requires int return
-- conio, deprecated library unavailable.
-- clrscr, unknown function
-- getch, unknown function

crappy coding style, unreadable, sloppy uses include:
-- no whitespace
-- no indentations
-- scanf
-- <math.h> library.... for what purpose?

given all of the above, i have doubts this will even work correctly. I'm certainly not going to go and fix these problems just to get it to compile properly to find out it's got more problems.

In the future the very least you can do, in a general C language forum, is two simple things:

(1) make sure your completed code COMPILES on any standard C compiler.
(2) make sure your completed code is READABLE without someone having to go through contortions to edit it.

[FAIL]


.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.