ME 218 LAB2 - } double ToMetric( double MPH) { double MPS;...

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

View Full Document Right Arrow Icon
Greg Gangluff gg2593 2/4/08 Lab 2 2.2 2.3 #include "stdio.h" void main() { int Pres, birth; printf("Enter The Year the 7th President was elected= "); scanf("%d", &Pres); printf("Enter The year your were born="); scanf("%d", &birth); printf("%d years have elpased from the election to your birth. \n", birth- Pres); } 2.4 #include "stdio.h" double ToMetric( double );
Background image of page 1

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

View Full DocumentRight Arrow Icon
main() { double MPH, MPS; printf("Enter a value in MPH to be converted to Meters per second= "); scanf("%lf" , &MPH); MPS = ToMetric(MPH); printf(" %lf miles per hour is %lf meters per second.\n", MPH, MPS);
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } double ToMetric( double MPH) { double MPS; MPS=MPH*.447; return MPS; } (b) #include "stdio.h" double ToMetric( double p); main() { double MPH, MPS; FILE *fp; fp = fopen("input.txt", "r"); fscanf(fp, "%d" &MPH); MPS = ToMetric(MPH); fclose(fp); fp = fopen("output", "w"); fprintf(fp, "output.txt","w"); fprintf(fp,"The speed equals %d in meters per second , MPS); fclose(fp); } double ToMetric( double p) { double o; o=p*.447; return o; }...
View Full 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.

Page1 / 2

ME 218 LAB2 - } double ToMetric( double MPH) { double MPS;...

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