0
Hello.How to develop a program that calculates the value of a function?
[-1,1] {sinx,-2<=x<=-1 {cose^x,-1<x<=0 y={tg lnx, 0<x<=1 {ctgx,1<x<=2
1 Answer
+ 7
E.g.
double f(int x)
{
if (x <= -1) return (sin(x));
if (x <= 0) return (cos(x));
// more
}
// call in main
int main()
{
std::cout << f(1);
std::cout << f(2);
}
http://www.cplusplus.com/reference/cmath/