What's new

this may be beginnier, but...

mesman00

What's that...?
not to do with emulation either, but how do i find the square root of a number using c++.

one more thing... msdn (microsoft developers network), is it free, is it a web page, if not, how much does it cost, cuz i can really use a copy
 
Last edited:

LoneRaven

Glide64 Website Guy
Hey Mesman00 here is a sample program for find the square root of a number:


#include <math.h>
#include <stdio.h>
#include <stdlib.h>

void main( void )
{
double question = 49, answer;

answer = sqrt( question );
if( question < 0 )
printf( "Error: sqrt returns %.2f\n, answer" );
else
printf( "The square root of %.2f is %.2f\n", question, answer );
}


Hope it helps. :thumbsup:
 
Last edited:
OP
mesman00

mesman00

What's that...?
alright, i thought i was told it was sqrt(), but never new it was in the math lib, thanks.
 

Cyberman

Moderator
Moderator
mesman00 said:
alright, i thought i was told it was sqrt(), but never new it was in the math lib, thanks.

Well try using the help :)
It should tell you what library it's in.. unless you are using DevC++ then you have to do it more yourself.

Math.h contains the function definitions for the library of mathematical functions as well as predefined things such as M_PI and M_PI2 etc.

Cyb
 

Top