Code:
```#include <stdio.h>
#include <math.h>
#include <time.h>
# include <conio.h>
int main()
{

unsigned long r;
int toets2;

do{
int textcolor();
int sleep();
float a,b,c;			/*a,b,c variabele d is de discriminant,i is voor de loop*/
int i=100000;
int j=1050000000;
printf("\t\t\4WORTELFORMULE BEREKENEN\4\n\n\n");

printf("\tDe functie is van de vorm: ax*x+bx+c=0\n\n");

printf("\tGeef een waarde in voor a\n\n\t");
scanf("%f",&a);
printf("\ta=%.2f\n",a);

printf("\n\tGeef een waarde in voor b\n\n\t");
scanf("%f",&b);
printf("\tb=%.2f\n",b);

printf("\n\tGeef een waarde in voor c\n\n\t");
scanf("%f",&c);
printf("\tc=%.2f\n",c);

printf("\tEven geduld de computer berekent de discriminant\n");
sleep(500);
printf("\tD=wortel uit(b*b)-(4*a*c)\n");
sleep(500);
double d,dd,uitkomst1,uitkomst2;
d=b*b-4*a*c;
dd=sqrt (d);
uitkomst2=(-b-dd)/(2*a);
uitkomst1=(-b+dd)/(2*a);

if(d<0){

textcolor(LIGHTRED);
printf("\tFout wortel van %.2f kan niet!!!\n\n",d);
textcolor(LIGHTGRAY);
}

else{
textcolor(GREEN);
printf("\tD=%.2f\n\n",dd);
printf("\tx1=%.2f\n\n",uitkomst1);
printf("\tOf....\n\n");
printf("\tx2=%.2f\n\n",uitkomst2);
textcolor(LIGHTGRAY);
}

printf("\t\t\t-=Druk op toets 1 om af te sluiten=-\n");
printf("\t\t\t\t\tOf....\n-=Druk op 2 om opnieuw een vierkantsvergelijking op te lossen.=-\n\t\t\t\t\t");

scanf("%d",&toets2);

r=r-1;

}
while(toets2>=2);

if(toets2==1)

return 0;
}```
1) this thing just calculates something and runs onder dos
2) i use the lcc win32 compiler
3) i want to use colors so when the sqrt<0 he is supposed to give an error in RED or LIGHTRED
if the sqrt>0 then he has to give x1 and x2 in GREEN or LIGHTGREeN
4) all of that works perfectly except for (now comes the prob):
a)i use a do while loop and it works, the first time u run it
the colors are displayed but if you press 2 at the end of the
program it starts all over again but the problem is that he
doesnt use the colors anymore, ive tried several ways and
none of them worked
b)also when the sqrt>0 he only gives of... in GREEN and the
part where printf("x1=%.2f",uitkomst1); is NOT in GREEN
i also have the same problem with
printf("x2=%.2f",uitkomst2);
So if ne1 knows how to solve this plz tell me
Greetz
Lamb

2. euhm doesnt any one wanna replie on this coz actually my question is very simple but mayb i should rephrase it ....

3. Originally posted by GanglyLamb
euhm doesnt any one wanna replie on this coz actually my question is very simple but mayb i should rephrase it ....
Rephrasing might be a good idea, I must admit I read it earlier and it didn't sink in, so I moved on. Maybe a short, clear example of the problem would be better.

4. ive made an exemple (a shorter one) to show what happens with my colors
now i also use the do while loop and i work with variables within the loop
and the funny thing is that in the short code the colors work BUT in the long one it doesnt but i cant see to find the error
anyway ill have a look at it AGAIN