L07libfuncs

L07libfuncs - can be just a simple constant or variable);...

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

View Full Document Right Arrow Icon
Looping constructs review What are named constants? Why are they needed? What is a block? What is special about declaring a variable inside a block? What is the difference between while and do-while ? Can one replace the other? what does for do? Why is it needed? what is init-statement , expression , post-statement in for? Can for replace while/do- while ? is reverse possible? how is break used inside a looping construct? what is continue , how is it used?
Background image of page 1

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

View Full DocumentRight Arrow Icon
Predefined Functions
Background image of page 2
Predefined Functions C++ comes with libraries of code that can be reused in your programs. The code comes in the form of pre-defined functions function name - identifier distinguishing the function from others; example square root function: sqrt argument - the value function starts out with; function may have more than one argument; an argument is an expression (thus,
Background image of page 3

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

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

Unformatted text preview: can be just a simple constant or variable); ● returned value- value computed by the function the_root = sqrt(9.0); ● function call ( function invocation ) - expression consisting of function name followed by arguments in parentheses ● function accepts parameters of certain type and returns value of certain type; sqrt accepts and returns double ● to use a function need to specify include directive: #include <cmath> Type Changing Functions ● is there a problem with this code? int a=9, b=2; double c=a/b ; ● C++ provides functions for explicit conversions between types: ● function double converts to type double: int a=9, b=2; double c=double(a)/b ; ● explicit type conversion is called type casting ● warning : wrong application of casting: int a=9, b=2; double c=double(a/b) ;...
View Full Document

This note was uploaded on 04/22/2010 for the course CS 23021 taught by Professor Staff during the Spring '08 term at Kent State.

Page1 / 4

L07libfuncs - can be just a simple constant or variable);...

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