need help on finding what i missed!
hello all, i made a simple function , its pretty simple, but i dont know why a specific if block doesnt execute !
( the one which checks whether power is zero or not )
here is the code
and below is the screen shot i got from a sample input , i also mentioned what i expected to get instead of that
Code:
void Integral( double multipicant,double power,char sign[],int size,int operand_number)
{
static int i =5,y=7,index = 0;
int int_power = 0
int condition = 0;
if ( index == 5)
{
i = 5;
y = 11;
}
if ( index >5 )
{
i+=1;
y = 11;
}
int_power = (int)power;//used to check if power is zero ( because power is declared double , and it is not wise to use a double variable in an if statement,
//i converted it to int
if ( 0 == int_power)
{
condition = 1;
gotoxy(i,y+4);
printf("%0.2f X ",fabs(multipicant));
if ( index != operand_number-1 )
{
gotoxy(i+5,y+4);
printf("%c",sign[index]);
}
}
if ( power == -1)
{
condition = 0;
gotoxy(i,y+4);
printf("%0.2f * Ln(x)",fabs(multipicant));
if ( index != operand_number-1 )
{
gotoxy(i+14,y+4);
printf("%c",sign[index]);
}
}
else
{
condition = 0;
gotoxy(i+9,y+2);
printf("%0.0f + 1",power);//the power of X
gotoxy(i+7,y+3);
printf("( X )");//print X
gotoxy(i,y+4);
printf("%0.2f *",fabs(multipicant));//multipicant
printf(" ------");//division line
gotoxy(i+6,y+5);
printf(" %0.0f + 1",power);//power
if ( index != operand_number-1 )
{
gotoxy(i+14,y+4);
printf("%c",sign[index]);
}
}
if (condition == 1)
{
i+=6;
}
else
{
i+=15;
}
index++;
return ;
}
Sample sreenshot
http://master.huricane.googlepages.c...screenshot.JPG
tanx in advance