Qhimm.com Forums
Miscellaneous Forums => Scripting and Reverse Engineering => Topic started by: Ant on 2001-11-20 13:09:00
-
How do you perform square root calculations in c++ ?
Thanks
-
There is a header file you can include called math.h
Then you can use the function
sqrt(the number you want to squareroot);
-
Thanks SaiNT
-
Can't you also do like
x^0.5
-
Don't think so; C++ has this fixation with using symbols for as many things as possible ... I believe ^ is used to do binary XOR.
-
C++ has the pow(number, tothepowerof) function, I think. It's in the math.h library.
-
Aaron : I was doing that for a while wondering why it was spewing out some hideous result.(Too much VB on the brain - not a good thing :smile: )
-
i dont completely understand the isdigit command of ctype.h..... I input 5 and get 4..... why? shouldn't i get 1?
-
On 2001-11-27 19:48, Darkness wrote:
i dont completely understand the isdigit command of ctype.h..... I input 5 and get 4..... why? shouldn't i get 1?
How exactly did you use it?
-
i was messing with it in my c++ class today......
something like this:
cin >> i;
x = isdigit(i);
if (x == 1)
{
cout << "Character is a Digit";
}
else
{
cout << "Character is not a Digit";
}
-
As the help says, isdigit returns nonzero if it is a number, else returns 0.
In c++ false = 0. true = anthing else.
fix that line to: if ( x )
or make it:
if (x == 0)
cout << "Character is not a Digit";
else
cout << "Character is a Digit";
-
yup. i fixed it earlier today. thats the EXACT words of my textbook.