|
-
Apr 5th, 2001, 04:34 PM
#1
Thread Starter
Addicted Member
Hihi. I'm in the middle of learning C++. Can any of you tell me how to get the square root of something? Like, in VB, you put Sqr(numberGoezHere). how do you do that in C++? and then, how do you raise something to a power?
To understand recursion, one must first understand the concept of recursion.
-
Apr 5th, 2001, 04:43 PM
#2
Monday Morning Lunatic
The mathematical functions are in math.h, but if you're using the Standard Library (like most of us ), they're then in cmath:
Code:
#include <iostream>
#include <cmath>
using namespace std;
void main() {
double x = 5;
cout << sqrt(x) << endl;
}
To raise to a power, use pow.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Apr 5th, 2001, 09:15 PM
#3
Thread Starter
Addicted Member
To understand recursion, one must first understand the concept of recursion.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|