[ Web Proxy ]
URL:
Viewing: https://raw.githubusercontent.com/ArashPartow/exprtk/master/exprtk_simple_example_12.cpp [Back]  [Original]

/*
 **************************************************************
 *         C++ Mathematical Expression Toolkit Library        *
 *                                                            *
 * Simple Example 12                                          *
 * Author: Arash Partow (1999-2025)                           *
 * URL: https://www.partow.net/programming/exprtk/index.html  *
 *                                                            *
 * Copyright notice:                                          *
 * Free use of the Mathematical Expression Toolkit Library is *
 * permitted under the guidelines and in accordance with the  *
 * most current version of the MIT License.                   *
 * https://www.opensource.org/licenses/MIT                    *
 * SPDX-License-Identifier: MIT                               *
 *                                                            *
 **************************************************************
*/


#include 

#include "exprtk.hpp"


template 
void bubble_sort()
{
   typedef exprtk::symbol_table symbol_table_t;
   typedef exprtk::expression   expression_t;
   typedef exprtk::parser       parser_t;

   const std::string bubblesort_program =
      " var upper_bound := v[];                      "
      "                                              "
      " repeat                                       "
      "    var new_upper_bound := 0;                 "
      "                                              "
      "    for (var i := 1; i < upper_bound; i += 1) "
      "    {                                         "
      "       if (v[i - 1] > v[i])                   "
      "       {                                      "
      "          v[i - 1]  v[i];                  "
      "          new_upper_bound := i;               "
      "       };                                     "
      "    };                                        "
      "                                              "
      "    upper_bound := new_upper_bound;           "
      "                                              "
      " until (upper_bound 

Web Proxy Viewer  |  New URL  |  Original Page