Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- template <class Data>
- Data Max(Data *x, int n){
- int i;
- Data max;
- max = x[0];
- for(i = 0; i < n; i++){
- if(x[i] > max){
- max = x[i];
- }
- }
- return max;
- }
- int main(){
- int age[5] = {5, 9 , 4, 7, 3};
- double cgpa[5] = {3.5, 1.9, 2.9, 3.9, 2.5};
- int ans;
- ans = Max(age, 5);
- cout << ans << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment