ME 218 Lab 11 - Greg Gangluff ME 218 (T 1 -3) 4/15/2008 Lab...

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

View Full Document Right Arrow Icon
Greg Gangluff ME 218 (T 1 -3) 4/15/2008 Lab 11 1) #include <stdio.h> #include <math.h> #define G 9.81 #define m 86.1 #define cd1 .375 #define cd2 18.38 void main( void ) { double h; double v; double dv; double t; double t2; FILE *fp; /* a variable associated with a file*/ fp = fopen("LOL.txt", "w"); t=0; v=0; printf("time, t velocity, v\n"); printf("input h: "); scanf("%lf",&h); while (t<= 20) { if (t<19) { dv=( G - cd1/m*v*v); fprintf(fp, "%lf %lf\n", t, v ); printf("%lf %lf\n", t, v); v= v+ h*dv; t= t+h; } else { dv=( G - cd2/m*v*v); fprintf(fp, "%lf %lf\n", t, v ); printf("%lf %lf\n", t, v); v= v+ h*dv; t= t+h; } t=t+h;} fclose(fp);
Background image of page 1

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

View Full DocumentRight Arrow Icon
Graph: 2) #include <stdio.h> #include <math.h> #define G 9.81 #define m 86.1 #define cd1 .375 #define cd2 18.38 void main( void ) { double h; double v; double dv; double t; double vmax; FILE *fp; /* a variable associated with a file*/ fp = fopen("LOL.txt", "w"); t=0; v=0; vmax=0; printf("time, t velocity, v\n"); printf("input h: "); scanf("%lf",&h); while
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/23/2011 for the course ME 218 taught by Professor Unknown during the Fall '08 term at University of Texas at Austin.

Page1 / 8

ME 218 Lab 11 - Greg Gangluff ME 218 (T 1 -3) 4/15/2008 Lab...

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

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