{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Lecture07 - Lecture 07 Functions vs Procedures Engineering...

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

Engineering 101 Engineering 101 Lecture 07 Lecture 07 Functions vs. Procedures Functions vs. Procedures Prof. Michael Falk University of Michigan, College of Engineering

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

View Full Document
Announcements Announcements Project1 Due Tonight at 9pm
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; }

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

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

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

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

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

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

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

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

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

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