Good evening. There is the easiest piece of code
int k = 0; for (double x = -2; x <= 2; x += 0.2) { try { mas_a[k] = sqrt(pow(x, 2) - 1); k++; } catch (EDivByZero &e) //ловим деление на 0 { mas_a[k] = 0; cout << "Деление на ноль целых чисел" << endl; k++; } catch (EZeroDivide &e) { mas_a[k] = 0; cout << "Деление на ноль вещественных чисел" << endl; k++; } cout << "[" << k << "]=>" << mas_a[k] << " | "; } It is necessary in the range [-2,2] in increments of 0.2 to fill the array by the function sqrt (pow (x, 2) - 1). And catch exceptions division by 0. Wrote, but swears on EZeroDivide and EDivByZero. What's wrong?
pow(x,2)-x*xand in short, and faster. - HarryEDivByZeroandEZeroDivide? And where do you have any throwing exceptions at all? - AnT