Here is my code.
#include <iostream>
#include<stdlib.h>
#include<stdio.h>
#include<conio.h>
#include<math.h>
#include <cmath>
#include <functional>
using namespace std;
void main()
{
cout<<log2(3.0)<<endl;
}
But above code gives error. Error code is : error C3861: 'log2': identifier not found. How can i calculate log2 using c++?
for example for log 3 in base 2
log (3) / log(2)
will do it.
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
cout << log(3.0) / log(2.0) << endl;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With