ME 218 LAB2

# ME 218 LAB2 - double ToMetric double MPH double MPS...

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

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 );

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

View Full Document
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
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

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern