Lec9 - Lecture 9 Functions Library(header file functions...

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

View Full Document Right Arrow Icon
Lecture 9: User defined functions 1 Lecture 9 Functions Library (header file) functions math.h examples: a=sqrt(10.0); b=sin(3.14159); c=pow(a,b); iomanip.h examples: setw(12) setprecision(3) User Defined Functions
Background image of page 1

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

View Full DocumentRight Arrow Icon
Lecture 9: User defined functions 2 User defined functions: Single-Result functions math.h functions are single-result functions You send the function information – called arguments- and it returns equal to a value Void functions You call the function - with or without information and it does something – e.g. a calculation, output etc. The function does not return a value. Can return information by changing the values of the arguments (more on this in Lecture 10)
Background image of page 2
Lecture 9: User defined functions 3 Recommended syntax: The best way to create a function is to use a prototype at the top of the program file and a function definition at the bottom. #include<header files > //prototype for function type functionname(variabletype, variabletype. .); void main() {
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/26/2008 for the course ENGR 1 taught by Professor X during the Spring '07 term at Lehigh University .

Page1 / 13

Lec9 - Lecture 9 Functions Library(header file functions...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online