I had just started learning C and just joined the group.

Presently I am reading the book "sams teach yourself C in 24hrs 2nd ed" 

The below source code is from page 151 of the book, I compiled it (using plato) 
but it gave me an error.
I noticed that the sqrt function referred to nothing.
But in the book it compiled successfully and the printed output was correct.

so my question  is; was the author mistaken & are there such similar errors in 
the book (for those who have read it before)?

Or is my compiler the problem.

Also is it possible to run C codes on Microsoft visual Studio C++



#include<stdio.h>
#include<math.h>
main()
{
  double x,y,z;
  x=64.0;
  y=3.0;
  z=0.5;

  printf("pow(64.0,3.0) returns: %7.0f\n",pow(x,y));
  printf("sqrt(64.0) returns:    %2.0f\n",sqrt);
  printf("pow(64.0,0.5) returns: %2.0f\n",pow(x,z));
  return 0;
}
  

N.B
There is something similar in pg 150 of the same book
printf("The cosine of 45 is :      %f.\n",cos);



      

[Non-text portions of this message have been removed]

Reply via email to