tags:

views:

83

answers:

1
    void get_formula_and_intervals()
        {           int i=0;
             while(1)
                {  if(scanf("%c",&(infix_formula[i]))!=1)
                     {  infix_formula[i]='\0';
                        break;
                     }
                   if(infix_formula[i]==' ')
                      continue;
                   else
                     { scanf("%c",&(infix_formula[i]));
                     ++i;
                     continue;
                     }
                }
            scanf("%lf %lf",&(alt_aralik),&(ust_aralik));
         return;
      }
    why above function doesnot take below input
  sqrt(133 - sin(3*1/3)^2.5) + 0.5*(31*-(311321) + 3.11 +1212)
  233 13
A: 

This provides a simple (not complete) fix to the logic for input; you did not post enough information to let us see what other issues there may be. It is a starting point, and assumes the variables in the function are global. And they match the datatypes specified in the format specifiers = %lf & %c.

void get_formula_and_intervals(void) 
{           
   int i=0;    
   memset(infix_formula, 0x0, sizeof(infix_formula));
   while(scanf("%c",&(infix_formula[i]))==1  && infix_formula[i]>31)
     i++; 
   infix_formula[i]=0x0;                
   scanf("%lf %lf",&(alt_aralik),&(ust_aralik)); 
   return; 
} 
jim mcnamara