W3 - 5/4/11 Workshop3~Functions(Part1)...

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

View Full Document Right Arrow Icon
Click to edit Master subtitle style 5/4/11 Workshop 3 ~ Functions (Part 1) CSIS 1117A 2009/09/24
Background image of page 1

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

View Full DocumentRight Arrow Icon
5/4/11 Outline Use the function calls provided in the libraries Write user define function calls Workshop Exercise
Background image of page 2
5/4/11 Check Even number (even.cpp) The user is required to input 5 integers and the  program will check whether they are even  numbers. 
Background image of page 3

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

View Full DocumentRight Arrow Icon
5/4/11 Program Result
Background image of page 4
5/4/11 Functions A function should be included: A function name Number of input parameters Type of each input parameters Return type
Background image of page 5

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

View Full DocumentRight Arrow Icon
5/4/11 User Defined Function Calls (iseven.cpp)
Background image of page 6
5/4/11 Random Numbers Include the library <cstdlib> The function call: rand() Returns an integer (0—RAND_MAX) 32767 for Dev-CPP
Background image of page 7

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

View Full DocumentRight Arrow Icon
5/4/11 Using Random Number Function  (iseven_random.cpp)
Background image of page 8
5/4/11 Result
Background image of page 9

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

View Full DocumentRight Arrow Icon
Random number within a range Example:  a random number within 0—99 rand()%100 Example: a random number within 1001—2000
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This document was uploaded on 05/04/2011.

Page1 / 20

W3 - 5/4/11 Workshop3~Functions(Part1)...

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

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