int main(int argc, char *argv[]) { double discriminant; struct Input input = getInput(argc, argv); discriminant=getDisc(input.a, input.b, input.c); if (discriminant>0) { double* reals = (double*) malloc(2*sizeof(double)); reals = twoReal(discriminant, input.a, input.b); output(2,reals); } else if (discriminant==0) { double* real = (double*) malloc(sizeof(double)); double realroot = oneReal(discriminant, input.a, input.b); real = &realroot; output(1, real); } else { double* imag = (double*) malloc(4*sizeof(double)); imag = noReals(discriminant, input.a, input.b); output(0, imag); } return 0; }
void Field::draw(std::ostream& os) { Disc* dsc; for(unsigned int i = height; i > 0; i--) { for(unsigned int j = 0; j < width; j++) { dsc = getDisc(j,i-1); if(dsc == NULL) { os << " ["; Field::spacer(os, tlMax, " "); os << "]"; } else { os << " [" << *dsc->getColor()->getToken(); Field::spacer(os, (unsigned int)(tlMax-dsc->getColor()->getToken()->length()), " "); os << "]"; } } os << std::endl; } // draw column numbers and separation line for(unsigned int i = 0; i < width; i++) { os << "---"; Field::spacer(os, tlMax, "-"); } os << std::endl; for(unsigned int i = 0; i < width; i++) { os << " [" << i+1; Field::spacer(os, tlMax-1, " "); os << "]"; } os << std::endl << std::endl; }
// Установка нового значения параметра и его проверка на корректность. void LocalParams::setValue(int16_t val) { uint8_t fract = pgm_read_byte(&getPtrParam()->fract); uint8_t disc = getDisc(); val = val * fract; val = (val / disc) * disc; this->val = val; checkValue(); }