82260a45db
Working on Ex2.4
20 lines
247 B
C++
Executable file
20 lines
247 B
C++
Executable file
//max.cc
|
|
namespace mylib {
|
|
double max( double a, double b ) {
|
|
if ( a < b ) {
|
|
return b;
|
|
}
|
|
|
|
return a;
|
|
}
|
|
|
|
int max( int a[], int size ) {
|
|
int m = a[0];
|
|
|
|
for( int i = 1; i < size ; ++i ) {
|
|
m = max(a[i], m);
|
|
}
|
|
|
|
return m;
|
|
}
|
|
}
|