NewC++ch06 - power point of chapter 6 and 7 of C++...

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

View Full Document Right Arrow Icon
C++ Programming: Program Design Including Data Structures, Second Edition Chapter 6: User-Defined Functions I
Background image of page 1

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

View Full DocumentRight Arrow Icon
C++ Programming: Program Design Including Data Structures, Second Edition 2 Objectives In this chapter you will: Learn about standard (predefined) functions Learn about user-defined functions Examine value-returning functions, including actual and formal parameters Explore how to construct and use a value- returning, user-defined function in a program
Background image of page 2
C++ Programming: Program Design Including Data Structures, Second Edition 3 Functions Functions Called modules Like miniature programs Can be put together to form a larger program
Background image of page 3

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

View Full DocumentRight Arrow Icon
C++ Programming: Program Design Including Data Structures, Second Edition 4 Predefined Functions Some of the predefined mathematical functions are: sqrt(x) pow(x,y) floor(x) Predefined functions are organized into separate libraries I/O functions are in iostream header Math functions are in cmath header
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
C++ Programming: Program Design Including Data Structures, Second Edition 6 User-Defined Functions Void functions : do not have a data type Value-returning functions : have a data type To use these functions you need to: Include the correct header file Know the name of the function Know the number of parameters, if any Know the data type of each parameter Know the data type of the value computed by the function, called the type of the function
Background image of page 6
C++ Programming: Program Design Including Data Structures, Second Edition 7 Value-Returning Functions Because the value returned by a value- returning function is unique, we must: Save the value for further calculation Use the value in some calculation Print the value A value-returning function is used in an assignment or in an output statement
Background image of page 7

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

View Full DocumentRight Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/03/2010 for the course COP 1334 taught by Professor Cooper during the Fall '10 term at Miami Dade College, Miami.

Page1 / 23

NewC++ch06 - power point of chapter 6 and 7 of C++...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online