Составители:
Рубрика:
{
case ' ' :GetNextChar();
break;
case '*' :{GetNextChar(); v=v * Factor();}
continue;
case '^' :{GetNextChar(); v=pow(v,Factor());}
continue;
case '/' :{GetNextChar();
if ((d = Factor()) != 0)
{ v=v/d; continue;}
else
{
printf("Ошибка!!! Деление на 0\n");
return 0;
}
}
default:
return v;
}
}
}
// формирование процесса вычисления введенного выражения
//
float Expression()
{
float v;
v=Term();
for(;;)
{
switch(NextChar)
{
case ' ' :GetNextChar();
break;
case '+' :
{GetNextChar(); v=v+Term();}
continue;
case '-' :{GetNextChar(); v=v-Term();}
continue;
default:
return v;
} //
} //