Hello,
Does anybody here know how I can put a cubic-root in C++?
Or is this impossible to do?
Thanks in advance!
Cubic-Roots in C++How to put a cubic-root in C++ (or is this impossible?)
Page 1 of 1
3 Replies - 3077 Views - Last Post: 10 December 2009 - 07:24 AM
Replies To: Cubic-Roots in C++
#2
Re: Cubic-Roots in C++
Posted 10 December 2009 - 02:15 AM
KoenM, on 10 Dec, 2009 - 07:25 AM, said:
Hello,
Does anybody here know how I can put a cubic-root in C++?
Or is this impossible to do?
Thanks in advance!
Does anybody here know how I can put a cubic-root in C++?
Or is this impossible to do?
Thanks in advance!
I'll reply here rather than replying to your PM.
It's always possible to get the cubic root in any language if you have an exponentiation function: you just have to remember that cubic root is actually bringing a number to the power 1/3.
#include <iostream>
#include <cmath>
int main() {
float i = 125.0;
std::cout << pow(i,(1/3.0)) << std::endl;
}
This post has been edited by EdwinNameless: 10 December 2009 - 02:23 AM
#3
Re: Cubic-Roots in C++
Posted 10 December 2009 - 03:01 AM
EdwinNameless, on 10 Dec, 2009 - 01:15 AM, said:
KoenM, on 10 Dec, 2009 - 07:25 AM, said:
Hello,
Does anybody here know how I can put a cubic-root in C++?
Or is this impossible to do?
Thanks in advance!
Does anybody here know how I can put a cubic-root in C++?
Or is this impossible to do?
Thanks in advance!
I'll reply here rather than replying to your PM.
It's always possible to get the cubic root in any language if you have an exponentiation function: you just have to remember that cubic root is actually bringing a number to the power 1/3.
#include <iostream>
#include <cmath>
int main() {
float i = 125.0;
std::cout << pow(i,(1/3.0)) << std::endl;
}
Thanks!
I will try this.
#4
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote





|