?? max.cpp
字號:
// find maximum of n numbers
#include <iostream.h>
template<class T>
int Max(T a[], int n)
{// Locate the largest element in a[0:n-1].
int pos = 0;
for (int i = 1; i < n; i++)
if (a[pos] < a[i])
pos = i;
return pos;
}
void main(void)
{
float a[6] = {1, 2, 3, 4, 5, 6};
cout << Max(a,6) << endl;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -