// Steve J. Hodges // CS19: C++ Programming // namespace-simple.cpp // Fall 2005 namespaces example #include //using namespace std; // include entire std namespace globally //using std::cout; // include a specific namespace item globally //using std::endl; // define a namespace // a standard is to use the revese-domain-name scheme // to ensure a unique name namespace net_steveh_findmax{ int findMax(int [], const int); // "High Water Mark Algorithm" int findMax(int ta[], const int S){ int max = ta[0]; for (int i=1; i < S ; i++){ if (ta[i] > max){ max = ta[i]; } } return max; } } int foo(){ int x = net_steveh_findmax::findMax(0,0); } main(){ using namespace net_steveh_findmax; // include entire namespace locally const int ASIZE=11; int a[]={-1,-2,-3,-4,0,-6,-7,-8,-9,-10,-11}; //int a[]={1,2,3,44,5,6,7,8,9,10,11}; std::cout << "findmax:" << std::endl; std::cout << "array: "; for(int i =0; i