{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture07 - Lecture 07 Functions vs Procedures Engineering...

Info icon This preview shows pages 1–13. Sign up to view the full content.

View Full Document Right Arrow Icon
Engineering 101 Engineering 101 Lecture 07 Lecture 07 Functions vs. Procedures Functions vs. Procedures Prof. Michael Falk University of Michigan, College of Engineering
Image of page 1

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

View Full Document Right Arrow Icon
Announcements Announcements Project1 Due Tonight at 9pm
Image of page 2
Functions Provide Structure Functions Provide Structure int main( ){ double A = 1.0, B; double C = 5.0; B = C; B = B + 3; B = B * A; double D = 3.0, E; E = D; E = E + 3; E = E * A; return 0; }
Image of page 3

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

View Full Document Right Arrow Icon
Functions Provide Structure Functions Provide Structure int main( ){ double A = 1.0, B; double C = 5.0; B = C; B = B + 3; B = B * A; double D = 3.0, E; E = D; E = E + 3; E = E * A; return 0; } Functions eliminate repetition
Image of page 4
Functions Provide Structure Functions Provide Structure int main( ){ double A = 1.0, B; double C = 5.0; B = f(C, A); double D = 3.0, E; E = f(D, A); return 0; } Functions eliminate repetition
Image of page 5

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

View Full Document Right Arrow Icon
Functions Provide Structure Functions Provide Structure int main( ){ double A = 1.0, B; double C = 5.0; B = f(C, A); double D = 3.0, E; E = f(D, A); return 0; }
Image of page 6
Functions Provide Structure Functions Provide Structure double f( double X, double Y){ double Z = X; Z = Z + 3; return Z * Y; } int main( ){ double A = 1.0, B; double C = 5.0; B = f(C, A); double D = 3.0, E; E = f(D, A); return 0; }
Image of page 7

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

View Full Document Right Arrow Icon
Functions Provide Structure Functions Provide Structure double f( double X, double Y){ double Z = X; Z = Z + 3; return Z * Y; } int main( ){ double A = 1.0, B; double C = 5.0; B = f(C, A); double D = 3.0, E; E = f(D, A); return 0; } output type input types
Image of page 8
Definition Or Declaration Must Definition Or Declaration Must Proceed Function Call Proceed Function Call double f( double X, double Y){ double Z = X; Z = Z + 3; return Z * Y; } int main( ){ double A = 1.0, B; double C = 5.0; B = f(C, A); double D = 3.0, E; E = f(D, A); return 0; } Function Definition Function Calls
Image of page 9

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

View Full Document Right Arrow Icon
Definition Or Declaration Must Definition Or Declaration Must Proceed Function Call Proceed Function Call double f( double X, double Y); int main( ){ double A = 1.0, B; double C = 5.0; B = f(C, A); double D = 3.0, E; E = f(D, A); return 0; } Function Declaration Function Calls
Image of page 10
Definition Or Declaration Must Definition Or Declaration Must Proceed Function Call Proceed Function Call double f( double X, double Y); int main( ){ double A = 1.0, B; double C = 5.0; B = f(C, A); double D = 3.0, E; E = f(D, A); return 0; } double f( double X, double Y){ double Z = X; Z = Z + 3; return Z * Y; } Function Declaration Function Calls Function Definition
Image of page 11

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

View Full Document Right Arrow Icon
Definition Or Declaration Must Definition Or Declaration Must Proceed Function Call Proceed Function Call
Image of page 12
Image of page 13
This is the end of the preview. Sign up to access the rest of the 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