October 2011
Beginner to intermediate
1200 pages
35h 33m
English
By now you are familiar with making function calls, but you may be less comfortable with function prototyping because that’s often been hidden in the include files. Listing 7.2 shows the cheers() and cube() functions used in a program; notice the function prototypes.
Listing 7.2. protos.cpp
// protos.cpp -- using prototypes and function calls#include <iostream>void cheers(int); // prototype: no return valuedouble cube(double x); // prototype: returns a doubleint main(){ using namespace std; cheers(5); // function call cout << "Give me a number: "; double side; cin >> side; double volume = cube(side); // function call cout << "A " << side <<"-foot cube has a volume of "; ...
Read now
Unlock full access