View Single Post
  #2   Spotlight this post!  
Unread 18-02-2006, 16:37
koenig3456 koenig3456 is offline
Programming Coach
None #0681 (EARTH Squad)
Team Role: Coach
 
Join Date: Jan 2006
Location: Pennsylvania
Posts: 16
koenig3456 is an unknown quantity at this point
Re: The silly syntax errors that won't go away!

Quote:
Originally Posted by TuaMater
Why won't the printf's output anything! It prints temp1: temp2: ground Vector:

aka what's the syntax for outputting doubles @($&^

double calcDistance(void)
{
double temp1 = 0.0;
double temp2 = 0.0;
double groundVector = 0.0;

printf("temp1: %4.0f ", temp1);

if (getTargetFound() == 1){

temp1 = (targetHeight - cameraHeight);

printf("temp1: %4.0f ", temp1);

temp2 = (getTiltAngle() * 3.14 / 180.0);

printf("temp2: %4.5f ", temp2);

groundVector = (temp1 / tan(temp2)) * ((temp1) / tan(temp2));

printf("Ground Vector: %f ", groundVector);

return groundVector;
}
else return 0.0;
}
printf on the RC doesn't support floating point numbers.