物件導向程式設計上機練習二(函式模板)

2021-08-08 05:04:12 字數 865 閱讀 8480

time limit: 1000ms

memory limit: 65536kb

submit

statistic

利用陣列和函式模板求5個數最大值(分別考慮整數、單精度、長整數的情況)。

分別輸入5個int型整數、5個float 型實數、5個long型正整數。

分別輸出5個int型整數的最大值、5個float 型實數的最大值、5個long型正整數的最大值。

11 22 666 44 55

11.11 22.22 33.33 888.88 55.55

1234567 222222 333333 444444 555555

666

888.88

1234567

#includeusing namespace std;

int max(int a)

return m;

}float max(float a)

return m;

}long max(long a)

return m;

}int main()

{ int i;

int a[5],imax;

for(i=0;i<5;i++)

cin>>a[i];

imax=max(a);

float b[5],fmax;

for(i=0;i<5;i++)

cin>>b[i];

fmax=max(b);

long c[5],lmax;

for(i=0;i<5;i++)

cin>>c[i];

lmax=max(c);

cout<

物件導向程式設計上機練習二(函式模板)

time limit 1000ms memory limit 65536kb submit statistic problem description 利用陣列和函式模板求5個數最大值 分別考慮整數 單精度 長整數的情況 input 分別輸入5個int型整數 5個float 型實數 5個long型正...

物件導向程式設計上機練習二(函式模板)

problem description 利用陣列和函式模板求5個數最大值 分別考慮整數 單精度 長整數的情況 input 分別輸入5個int型整數 5個float 型實數 5個long型正整數。output 分別輸出5個int型整數的最大值 5個float 型實數的最大值 5個long型正整數的最大...

1141 物件導向程式設計上機練習二(函式模板)

time limit 1000ms memory limit 65536k 有疑問?點這裡 利用陣列和函式模板求5個數最大值 分別考慮整數 單精度 長整數的情況 分別輸入5個int型整數 5個float 型實數 5個long型正整數。分別輸出5個int型整數的最大值 5個float 型實數的最大值 ...