int placeconv(Fmt *fp) { char str[256]; int n; Place pl; pl = va_arg(fp->args, Place); n = 0; n += printlatlon(str+n, sizeof(str)-n, pl.lat, 'N', 'S'); n += snprint(str+n, sizeof(str)-n, ", "); printlatlon(str+n, sizeof(str)-n, pl.lon, 'E', 'W'); return fmtstrcpy(fp, str); }
void rocket::print() { printf("Time: %02i:%02i:%02i:%02i\n", (int)(time/3600), (int)(time/60)%60, (int)(time)%60, (int)(time*60)%60); for (int i = 0; i < parts.size(); i++) { parts[i]->print(); } printf(" Velocity: %.4f\n", length(vel)); printf(" Altitude: %.2f\n", altitude()); printf(" "); printlatlon(pos); DEBUG(printf(" Air density: %f\n", airdensity(altitude()))); DEBUG(printf(" Mass: %f\n", mass)); DEBUG(float v = length(vel); printf(" Drag: %f\n", v * v * .5 * crosssection() * airdensity(altitude()) * dragcoef(v))); }