+ 2

# Make funtion f(x)=ln(x+1)-ln(x)

help me

4 Answers

+ 14

#include <cmath>
...
double func(double x) {
return log(x + 1) - log(x);
}
int main() {
double num = 5.0;
std::cout << func(num);
}

+ 7

@Oma Falk
You will have to use brackets there.
log(x+1/x) != log((x+1)/x)

+ 3

#include <cmath>
...
double mylog(double x) {
return log(x + 1/x);
}

+ 3

@Kinshuk
good idea (-: