IIRC:
pow ( abs ( val ), 1.0 / 3.0 )
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
Dave Sinkula
long time no c
5,058 posts since Apr 2004
Reputation Points: 2,780
Solved Threads: 314
>it would greatly help me to see the entire program from start to finish
#include <cstdlib>
#include <cmath>
#include <iostream>
int main()
{
int val;
std::cout<<"Enter a number: ";
if ( std::cin>> val ) {
std::cout<<"Cube root of "<< val <<": "
<< std::pow ( std::abs ( val ), 1.0 / 3.0 ) <<std::endl;
}
}
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>That one is more advanced than I am
Aroo? And then you post a manual attempt at it? :eek:
>while (x - (a)(a)(a)) < 0.001)
(a)(a)(a) likely doesn't do what you think it does. ;) Perhaps you were trying to do:
while (x - (a * a * a)) < 0.001)
>a = b;
b doesn't have a value yet. You'll probbly get strange results.
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
>What should i do with b?
How should I know, it's your program. ;) You put b there for a reason, right?
Narue
Bad Cop
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401