Calling the Functions

The only difference that results from calling the functions in the new modules is the need to qualify function names with their namespace. Listing 8.5 shows the new main.cpp.

Listing 8.5. main.cpp Calling on Separately Compiled Modules
 1: #include <iostream> 2: *3: #include "PromptModule.h" *4: #include "ErrorHandlingModule.h" 5: 6: using namespace std; 7: 8: float GetDividend(void) 9: { 10: float Dividend = 0; 11: 12: cout << "Dividend: "; 13: cin >> Dividend; 14: 15: return Dividend; 16: } 17: 18: float GetDivisor(void) 19: { 20: float Divisor = 1; 21: 22: cout << "Divisor: "; 23: cin >> Divisor; 24: 25: return Divisor; 26: } 27: 28: float Divide 29: (const float theDividend,const float theDivisor) 30: { 31: return (theDividend/theDivisor); ...

Get SAMS Teach Yourself C++ in 10 Minutes SECOND EDITION now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.