Test

28.08.17 03:38 PM Comment(s) By Umar Lone

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#include <iostream>

template<typename T>
T max(T *pArr, T arrSize) {
	int largestIndex = 0;
	for (int i = 0; i < arrSize; i++) {
		if (largestIndex < pArr[i]) {
			largestIndex = pArr[i];
		}
	}
	return largestIndex;
}

int main() {

	int pArr[5] = { 32,22,90,3,44 };
	std::cout << max(pArr, 5) << std::endl;
	return 0;
}
Share -