⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 indexofmax.cpp

📁 这是数据结构、算法与应用-C++语言描述的代码
💻 CPP
字号:
// find location of maximum of n numbers

#include <iostream>
#include <algorithm> // has copy
#include "indexOfMax.h"

using namespace std;

int main()
{
   int a[6] = {1, 4, 2, 5, 6, 3};

   // output the array elements
   cout << "a[0:5] = ";
   copy(a, a+6, ostream_iterator<int>(cout, " "));
   cout << endl;

   // test the function indexOfMax
   cout << "max(a,1) = " << a[indexOfMax(a,1)] << endl;
   cout << "max(a,3) = " << a[indexOfMax(a,3)] << endl;
   cout << "max(a,6) = " << a[indexOfMax(a,6)] << endl;
   return 0;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -