Functions and function calls

Functions and function calls - Functions and function calls...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: Functions and function calls Let’s assume you have a program like the following: #include <iostream> #include <iomanip> using namespace std ; //Function Prototype void Find_Average( int , int , int , int & , float & ) ; // 3 int parameters are passed by value no changes allowed // 2 parameters passed by reference denoted by & operator any change will be remembered int main() { // Declaration section: Local variable declared to be used in main function only int Num1, Num2, Num3 , Total ; float Average ; // Code Section cout <<” Enter 3 integer numbers separated with at least 1 blank space to process: “ ; cin >> Num1 >> Num2 >> Num3 ; Find_Average (Num1, Num2, Num3, Total, Average); // Call function Find_Average to process the numbers // Num1, Num2, and Num3 are used to pass the input required by Find_Average to the function, // they correspond to the first 3 parameters on the definition side of the function // Total and Average are used to bring back the values calculated by the function // They correspond to the fort and fifth parameters on the definition side and are denoted by &...
View Full Document

This note was uploaded on 11/01/2009 for the course CS 101 at USC.

Page1 / 3

Functions and function calls - Functions and function calls...

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

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