
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

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 what does for do? Why is it needed? what is init-statement , expression , post-statement in for? how is break used inside a looping construct What is continue, how is it used
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 can be a constant, variable or expression 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
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);