sortemp.cpp

来自「本课程主要介绍面向对象程序设计的方法和c++语言的基本概念。以c++语言中的面向」· C++ 代码 · 共 21 行

CPP
21
字号
// sortemp.cpp
// sorts array of doubles in backwards order,
// uses greater<>() function object
#include <iostream>
#include <algorithm>                  //for sort()
#include <functional>                 //for greater<>
using namespace std;
                                      // array of doubles
double fdata[] = { 19.2, 87.4, 33.6, 55.0, 11.5, 42.2 };

int main()
   {                                  // sort the doubles
   sort( fdata, fdata+6, greater<double>() );

   for(int j=0; j<6; j++)             // display sorted doubles
      cout << fdata[j] << ' ';
   cout << endl;
   return 0;
   }

⌨️ 快捷键说明

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