#include <cmath>
....
int x0 = 0;
int xk = 0;
int h = 0;
double F = 0.0;
cin >> x0 >> xk >> h;
int b = 0;
cin >> b;
for(int i = x0; i<xk; i=i+h){
if(i<2){
F = arctan(x)+sqrt(abs(x-2));
}
else if(i==2){
F = (5-powl(b,2))+cos(M_PI) * x;
else if(i>2){
F = log(x-2)*sin(x/2);
cout << F;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
#include <cmath>
....
int x0 = 0;
int xk = 0;
int h = 0;
double F = 0.0;
cin >> x0 >> xk >> h;
int b = 0;
cin >> b;
for(int i = x0; i<xk; i=i+h){
if(i<2){
F = arctan(x)+sqrt(abs(x-2));
}
else if(i==2){
F = (5-powl(b,2))+cos(M_PI) * x;
}
else if(i>2){
F = log(x-2)*sin(x/2);
}
cout << F;