chapter 9 part 1 foc

Cards (14)

  • Function
    A rule or correspondence between values, called the function's arguments, and the unique value of the function associated with the arguments
  • Types of C++ functions
    • Standard functions
    • User-defined functions
  • C++ function structure

    • Function signature
    • Function body
  • Declaring and Implementing C++ functions
    1. Sharing data among functions through function parameters
    2. Value parameters
  • Function arguments
    Constants, variables or more complex expressions
  • Why using functions
    • Divide and conquer
    • Reusability
    • Components
  • Predefined functions
    Part of the C++ language, provided in function libraries
  • Predefined functions
    • abs(x)
    • sin(x)
    • log(x)
    • pow(x, n)
  • Library functions
    Built-in functions that come with the compiler, source code definition does not appear in your program
  • Header files for library functions
    • cctype
    • cmath
    • stdlib
    • time
  • Library functions work as a black box
  • Math functions in cmath
    • abs(x)
    • pow(x,y)
    • pow10(x)
    • sqrt(x)
  • Library function examples
    • Calculating area of a circle
    • Calculating square root of sum of two numbers
  • More mathematical functions in cmath
    • sin
    • cos
    • tan
    • sqrt
    • log
    • abs