HW3_ruzmora

HW3_ruzmora - /* Chapter 3 Problem 30 */ /* This program...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 /* Chapter 3 Problem 30 */ /* This program will determine the time at which a rocket descends back to Earth*/ #include <stdio.h> #define FILENAME "rocket1.txt" int main(void) { /*Declare and initialize variables */ FILE *rocket1 int ndpts int k double time,prev_time, current_time, now_altitude, velocity, acceleration, prev_altitude rocket1 = fopen(FILENAME, "r") if (rocket1 == NULL) { printf("Error opening input file \n") } else { prev_altitude = now_altitude prev_time = time for (k = 0 k < (ndpts - 1) { if (now_altitude < prev_altitude) { if (prev_time < time) { current_time = prev_time break } } prev_time = time prev_altitude = now_altitude } printf("The rocket starts to descend at:%6.2f\n", current_time) fclose(rocket1) } /*Pause program */ getchar() getchar() g /* Exit program */ return 0 }
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/21/2010 for the course EEL 2161 taught by Professor Lopez during the Spring '10 term at FAU.

Page1 / 10

HW3_ruzmora - /* Chapter 3 Problem 30 */ /* This program...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online