-
Functions, & O.O.P.–C++ Notes (C Plus Plus Notes)
Functions Performing a task in a program requires a function! The function hides from its user the complex tasks that it performs. C++ Functions–A function is a block of code which only runs when it is called. Data, known as parameters, can be passed into a function. Functions are used to perform certain tasks, or actions, and they are important for reusing code: Define the code once, and use it many times. C++ provides some pre-defined functions, such as ‘main()‘ which is used to execute code. But you can also create your own functions to perform certain actions. C++ Functions consist of two parts: Declaration–the functions name, return type, and…