1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
//MaximumInArrayUse.cpp
/************************************************************
This is the file that holds the main function. *
*************************************************************/
#include "MaximumInArray.h" //Requiring MaximuminArray.h
#include "MaximumInArray.cpp" //Requiring MaximumInArray.cpp
using namespace std;
int main()
{
// Array with doubles
double doubles[] = {1.5, 4.6, 3.1, 1.1, 3.8};
// Array with integers
int integers[] = {2, 22, 4, 6, 122,};
// Array with strings
string strings[] = {"texas", "arizona", "oklahoma", "washington", "california"};
// Checking the size of the double array
const int doubleSize = sizeof doubles/sizeof doubles[0];
// Show on the screen the maximum value of the array
cout << "Maximum double in array is " << max(doubles, doubleSize) << endl;
// Checking the size of the double array
const int integerSize = sizeof integers/sizeof integers[0];
// Show on the screen the maximum value of the array
cout << "Maximum integer in array is " << max(integers, integerSize) << endl;
// Checking the size of the double array
const int stringsSize = sizeof strings/sizeof strings[0];
// Show on the screen the maximum value of the array
cout << "Maximum string in array is " << max(strings, stringsSize) << endl;
return 0;
}
|