# Ch2_9 - Next Previous Section 2.9 Single Result Functions...

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

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

View Full Document

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Next Previous Section 2.9: Single Result Functions Section 2.9: Single Result Functions 11 ® Functions ® Library (header file) functions ® <cmath> examples: l a=sqrt(10.0); b=cos(3.14159); c=pow(a,b); ® <iomanip> examples: l setw(12) setprecision(3) ® User Defined Functions ® Single Result Functions l returns one result Section 2.9: Single Result Functions Next Previous Section 2.9: Single Result Functions Section 2.9: Single Result Functions 22 ® Single-Result functions ® <cmath> functions are single-result functions ® You "call" the function and send it information ® send information as arguments e.g. pow (x, a) ® function returns a single value, which is: ® assigned to a variable, or ® printed directly as output ® Void functions ® You "call" the function without assigning it to a variable ® with or without argument information ® when called, it performs an operation l 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 section 10) "argument s" User defined functions Next Previous Section 2.9: Single Result Functions Section 2.9: Single Result Functions 33 ® The best way to create a function is to place a function declaration before the main program and a function definition...
View Full Document

{[ snackBarMessage ]}

### Page1 / 13

Ch2_9 - Next Previous Section 2.9 Single Result Functions...

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

View Full Document
Ask a homework question - tutors are online