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

Info icon This 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 );
Image of page 1

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern